What This Script Does: • Creates a camera + monitor + 3D desktop environment. • Animates the camera diving into the monitor, rotating to look out at you, then swooping back out. • Adds a glass-like transparent plane to simulate a “looking out from inside the screen” moment. • Fully keyframed with hold sections and transition arcs.
Created
May 10, 2025 22:14
-
-
Save Cdaprod/137b2cbb3dc13b34feafd2ac1c46c018 to your computer and use it in GitHub Desktop.
Blender Python - Cinematic Monitor Dive & Return
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import math | |
| # Clean up | |
| bpy.ops.object.select_all(action='SELECT') | |
| bpy.ops.object.delete(use_global=False) | |
| # Frame settings | |
| scene = bpy.context.scene | |
| scene.frame_start = 1 | |
| scene.frame_end = 240 # 10 seconds at 24fps | |
| # Create camera | |
| bpy.ops.object.camera_add(location=(0, -10, 1.5), rotation=(math.radians(90), 0, 0)) | |
| camera = bpy.context.active_object | |
| scene.camera = camera | |
| # Add monitor screen (plane) | |
| bpy.ops.mesh.primitive_plane_add(size=4, location=(0, 0, 1.5)) | |
| monitor = bpy.context.active_object | |
| monitor.name = "MonitorScreen" | |
| # Add environment object inside monitor (cube as placeholder) | |
| bpy.ops.mesh.primitive_cube_add(size=8, location=(0, 6, 1.5)) | |
| env = bpy.context.active_object | |
| env.name = "VirtualDesktopEnv" | |
| # Add reflection plane (screen lookback) | |
| bpy.ops.mesh.primitive_plane_add(size=4, location=(0, 0.01, 1.5)) | |
| reflection = bpy.context.active_object | |
| reflection.name = "ScreenReflection" | |
| mat = bpy.data.materials.new(name="GlassLook") | |
| mat.use_nodes = True | |
| bsdf = mat.node_tree.nodes["Principled BSDF"] | |
| bsdf.inputs["Transmission"].default_value = 1.0 | |
| bsdf.inputs["Roughness"].default_value = 0.05 | |
| reflection.data.materials.append(mat) | |
| # Camera animation: approach screen | |
| camera.location = (0, -10, 1.5) | |
| camera.keyframe_insert(data_path="location", frame=1) | |
| camera.location = (0, -1.5, 1.5) | |
| camera.keyframe_insert(data_path="location", frame=60) | |
| # Camera rotates inside screen | |
| camera.rotation_euler = (math.radians(90), 0, 0) | |
| camera.keyframe_insert(data_path="rotation_euler", frame=60) | |
| camera.rotation_euler = (math.radians(90), 0, math.radians(180)) | |
| camera.keyframe_insert(data_path="rotation_euler", frame=100) | |
| # Camera holds inside monitor | |
| camera.location = (0, 2.5, 1.5) | |
| camera.keyframe_insert(data_path="location", frame=100) | |
| camera.keyframe_insert(data_path="location", frame=140) | |
| # Exit transition: zooms back out | |
| camera.location = (0, -10, 1.5) | |
| camera.keyframe_insert(data_path="location", frame=180) | |
| camera.rotation_euler = (math.radians(90), 0, math.radians(360)) | |
| camera.keyframe_insert(data_path="rotation_euler", frame=180) | |
| # Final hold | |
| camera.keyframe_insert(data_path="location", frame=240) | |
| camera.keyframe_insert(data_path="rotation_euler", frame=240) | |
| # Adjust render settings (optional) | |
| scene.render.fps = 24 | |
| scene.render.image_settings.file_format = 'FFMPEG' | |
| scene.render.filepath = "//monitor_inside_transition.mp4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment