diff --git a/notebooks/lighting_demo.ipynb b/notebooks/lighting_demo.ipynb index 59086cd5..1cd5b7fa 100644 --- a/notebooks/lighting_demo.ipynb +++ b/notebooks/lighting_demo.ipynb @@ -216,13 +216,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ee958a7eb4de486dbfc1a4a13b0ef0af", + "model_id": "53876d4ecc6e4f38890459f619d6b8fe", "version_major": 2, "version_minor": 0 }, @@ -260,7 +260,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -276,7 +276,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -286,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -295,7 +295,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -312,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -331,7 +331,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -348,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -372,7 +372,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -390,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -615,13 +615,13 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "8704c06726ca4234b216c5f3b9323c01", + "model_id": "94b122b532cd41529f9cf9d03bbf94fa", "version_major": 2, "version_minor": 0 }, @@ -654,7 +654,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -695,7 +695,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -845,12 +845,93 @@ "spot1.shadow_bias=-0.0005" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Animated Light" + ] + }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c993ddb4d5ac496ca269b14532c3aa0b", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "VBox(children=(Figure(camera=PerspectiveCamera(fov=45.0, position=(0.0, 0.0, 2.0), quaternion=(0.0, 0.0, 0.0, …" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "[b1, p1, s1] = plot_all_no_change(kb=True, wp=True, ts=False)\n", + "point1=p3.point_light()\n" + ] + }, + { + "cell_type": "code", + "execution_count": 48, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# Light and shadow Setup\n", + "point1.position_x=20\n", + "point1.position_y=10\n", + "point1.position_z=0\n", + "point1.cast_shadow = True\n", + "b1.cast_shadow = True\n", + "b1.receive_shadow = True\n", + "p1.receive_shadow = True\n", + "point1.shadow_map_type='PCF_SOFT'\n", + "point1.shadow_map_size=1024\n", + "# point1.shadow_radius=20 \n", + "point1.decay = 2" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4a6e362235ab4017ac86e9b85dea240c", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Generating gif with animated light position\n", + "def set_pos(fig, i, fraction):\n", + " point1.position_x = np.sin(2*np.pi*fraction) * 20\n", + " point1.position_z = np.cos(2*np.pi*fraction) * 20\n", + " \n", + "# a = p3.movie('rotatelight.gif', set_pos, fps=20, frames=40, endpoint=False, cmd_template_gif)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "" + ] } ], "metadata": { @@ -869,7 +950,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.6.10" } }, "nbformat": 4, diff --git a/notebooks/rotatelight.gif b/notebooks/rotatelight.gif new file mode 100644 index 00000000..9011ef3e Binary files /dev/null and b/notebooks/rotatelight.gif differ