Skip to content

Commit 3bb810e

Browse files
enable lighting
1 parent fb6620b commit 3bb810e

File tree

1 file changed

+238
-0
lines changed

1 file changed

+238
-0
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import ipyvolume as ipv\n",
10+
"import numpy as np\n",
11+
"\n",
12+
"a0 = np.array([0.])\n",
13+
"a1 = np.array([1.])\n",
14+
"\n",
15+
"def scene(flip):\n",
16+
" ipv.xyzlim(-1, 1)\n",
17+
" ipv.light_ambient(intensity=0.4)\n",
18+
" ipv.light_directional(position=[0, 50, 0]);\n",
19+
" if flip:\n",
20+
" s = ipv.quiver(a0, a0, a0, a0, -a1, a0, marker=\"sphere\", size=20);\n",
21+
" else:\n",
22+
" s = ipv.scatter(a0, a0, a0, marker=\"sphere\", size=20);\n",
23+
" m = ipv.plot_plane('bottom')\n",
24+
" ipv.show()"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": 2,
30+
"metadata": {},
31+
"outputs": [
32+
{
33+
"data": {
34+
"application/vnd.jupyter.widget-view+json": {
35+
"model_id": "da839894b78744e6bbdcf834e89fc301",
36+
"version_major": 2,
37+
"version_minor": 0
38+
},
39+
"text/plain": [
40+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
41+
]
42+
},
43+
"metadata": {},
44+
"output_type": "display_data"
45+
}
46+
],
47+
"source": [
48+
"f = ipv.figure()\n",
49+
"ipv.material_physical(flat_shading=False)\n",
50+
"scene(flip=False)"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 3,
56+
"metadata": {},
57+
"outputs": [
58+
{
59+
"data": {
60+
"application/vnd.jupyter.widget-view+json": {
61+
"model_id": "90e1b671d3c84255a8ddae4527001cbc",
62+
"version_major": 2,
63+
"version_minor": 0
64+
},
65+
"text/plain": [
66+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
67+
]
68+
},
69+
"metadata": {},
70+
"output_type": "display_data"
71+
}
72+
],
73+
"source": [
74+
"f = ipv.figure()\n",
75+
"ipv.material_physical(flat_shading=True)\n",
76+
"scene(flip=False)"
77+
]
78+
},
79+
{
80+
"cell_type": "code",
81+
"execution_count": 4,
82+
"metadata": {},
83+
"outputs": [
84+
{
85+
"data": {
86+
"application/vnd.jupyter.widget-view+json": {
87+
"model_id": "250b7721e554499e89b4c656ca5cb8dd",
88+
"version_major": 2,
89+
"version_minor": 0
90+
},
91+
"text/plain": [
92+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
93+
]
94+
},
95+
"metadata": {},
96+
"output_type": "display_data"
97+
}
98+
],
99+
"source": [
100+
"f = ipv.figure()\n",
101+
"ipv.material_physical()\n",
102+
"scene(flip=True)"
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": 5,
108+
"metadata": {},
109+
"outputs": [
110+
{
111+
"data": {
112+
"application/vnd.jupyter.widget-view+json": {
113+
"model_id": "1641e7cce9cf48e4b550c2cfd1326e69",
114+
"version_major": 2,
115+
"version_minor": 0
116+
},
117+
"text/plain": [
118+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
119+
]
120+
},
121+
"metadata": {},
122+
"output_type": "display_data"
123+
}
124+
],
125+
"source": [
126+
"f = ipv.figure()\n",
127+
"ipv.material_phong()\n",
128+
"scene(flip=False)"
129+
]
130+
},
131+
{
132+
"cell_type": "code",
133+
"execution_count": 6,
134+
"metadata": {},
135+
"outputs": [
136+
{
137+
"data": {
138+
"application/vnd.jupyter.widget-view+json": {
139+
"model_id": "e3f9c5690ed24667ab3f3e650ef4fddf",
140+
"version_major": 2,
141+
"version_minor": 0
142+
},
143+
"text/plain": [
144+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
145+
]
146+
},
147+
"metadata": {},
148+
"output_type": "display_data"
149+
}
150+
],
151+
"source": [
152+
"f = ipv.figure()\n",
153+
"ipv.material_phong()\n",
154+
"scene(flip=True)"
155+
]
156+
},
157+
{
158+
"cell_type": "code",
159+
"execution_count": 7,
160+
"metadata": {},
161+
"outputs": [
162+
{
163+
"data": {
164+
"application/vnd.jupyter.widget-view+json": {
165+
"model_id": "72a6e50c55bd438580c43cfd32da5ed3",
166+
"version_major": 2,
167+
"version_minor": 0
168+
},
169+
"text/plain": [
170+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
171+
]
172+
},
173+
"metadata": {},
174+
"output_type": "display_data"
175+
}
176+
],
177+
"source": [
178+
"f = ipv.figure()\n",
179+
"ipv.material_lambert()\n",
180+
"scene(flip=False)"
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": 8,
186+
"metadata": {},
187+
"outputs": [
188+
{
189+
"data": {
190+
"application/vnd.jupyter.widget-view+json": {
191+
"model_id": "e1fc83bb96fe4635a491101d86336c64",
192+
"version_major": 2,
193+
"version_minor": 0
194+
},
195+
"text/plain": [
196+
"VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), projectionMatrix=(1.0, 0.0,…"
197+
]
198+
},
199+
"metadata": {},
200+
"output_type": "display_data"
201+
}
202+
],
203+
"source": [
204+
"f = ipv.figure()\n",
205+
"ipv.material_lambert()\n",
206+
"scene(flip=True)"
207+
]
208+
},
209+
{
210+
"cell_type": "code",
211+
"execution_count": null,
212+
"metadata": {},
213+
"outputs": [],
214+
"source": []
215+
}
216+
],
217+
"metadata": {
218+
"kernelspec": {
219+
"display_name": "Python 3",
220+
"language": "python",
221+
"name": "python3"
222+
},
223+
"language_info": {
224+
"codemirror_mode": {
225+
"name": "ipython",
226+
"version": 3
227+
},
228+
"file_extension": ".py",
229+
"mimetype": "text/x-python",
230+
"name": "python",
231+
"nbconvert_exporter": "python",
232+
"pygments_lexer": "ipython3",
233+
"version": "3.7.3"
234+
}
235+
},
236+
"nbformat": 4,
237+
"nbformat_minor": 5
238+
}

0 commit comments

Comments
 (0)