Claude 3.
7 Prompts & Python code By Nissam
Our AI Tools Directory: [Link]
The Prompt:
Write a Blender Python script to create a 3D animation scene with the following features:
1. The scene should use the Eevee Next render engine and include bloom effects.
2. Clear all existing objects in the scene before starting.
3. Create a simple straight road using a plane scaled along the Y-axis, with road markings down
the center.
4. Add a simple car made from cubes for the body and cabin, and cylinders for the wheels. The
car should have materials: a red, metallic body, dark windows for the cabin, and black rubber
wheels.
5. Add trees along both sides of the road. Each tree consists of a cylinder trunk and a cone top
for leaves. The trunk should be brown, and the leaves should be green.
6. Animate the car to move along the road from one end to the other in 120 frames. Make the
animation cyclic so the car continuously loops along the road.
7. Add a sky environment with a light blue color.
8. Set up lighting for the scene with a main sunlight, a rim light for the car, and a fill light. Adjust
the colors and intensities to create a natural look.
9. Add a camera positioned to capture the car's movement along the road and set it as the
active camera.
10. Smooth the car's body and tree objects for a polished look.
The First Error:
Report: Error
Python: Traceback (most recent call last):
File "\Text", line 10, in <module>
TypeError: bpy_struct: [Link] = val: enum "EEVEE_NEXT" not found in
('BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH', 'CYCLES')
The Second Error:
Report: Error
× Python: Traceback (most recent call last):
File "\Text", line 27, in <module>
File "\Text", line 23, in create_material
KeyError: 'bpy_prop_collection [key]: key "Specular" not found'
THE PYTHON SCRIPT FOR BLENDER:
import bpy
import math
from mathutils import Vector
# Clear existing objects
[Link].select_all(action='SELECT')
[Link]()
# Set render engine to Eevee Next and enable bloom
[Link] = 'BLENDER_EEVEE_NEXT'
[Link].use_bloom = True
[Link].bloom_intensity = 0.05
[Link].bloom_threshold = 1.0
# Create materials
def create_material(name, base_color, metallic=0.0, roughness=0.5, specular=0.5):
material = [Link](name)
material.use_nodes = True
bsdf = material.node_tree.[Link]('Principled BSDF')
[Link]['Base Color'].default_value = base_color
[Link]['Metallic'].default_value = metallic
[Link]['Roughness'].default_value = roughness
if 'Specular IOR Level' in [Link]:
[Link]['Specular IOR Level'].default_value = specular
elif 'Specular' in [Link]:
[Link]['Specular'].default_value = specular
return material
# Create materials for our objects
car_body_material = create_material("CarBody", (0.8, 0.0, 0.0, 1.0), metallic=0.9,
roughness=0.1)
car_window_material = create_material("CarWindow", (0.02, 0.02, 0.02, 1.0), roughness=0.05)
wheel_material = create_material("Wheel", (0.02, 0.02, 0.02, 1.0), roughness=0.7)
road_material = create_material("Road", (0.1, 0.1, 0.1, 1.0), roughness=0.9)
tree_trunk_material = create_material("TreeTrunk", (0.3, 0.2, 0.1, 1.0), roughness=0.8)
tree_leaves_material = create_material("TreeLeaves", (0.0, 0.4, 0.0, 1.0), roughness=0.7)
# Create road
[Link].primitive_plane_add(size=1, enter_editmode=False, align='WORLD', location=(0,
0, 0))
road = [Link].active_object
[Link] = "Road"
[Link] = (2, 15, 1)
[Link](road_material)
# Create road markings
[Link].primitive_plane_add(size=1, enter_editmode=False, align='WORLD', location=(0,
0, 0.01))
road_marking = [Link].active_object
road_marking.name = "RoadMarking"
road_marking.scale = (0.05, 15, 1)
road_marking_material = create_material("RoadMarking", (1, 1, 1, 1))
road_marking.[Link](road_marking_material)
# Create car body
[Link].primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(0,
-10, 0.3))
car_body = [Link].active_object
car_body.name = "CarBody"
car_body.scale = (0.8, 1.2, 0.25)
car_body.[Link](car_body_material)
# Add smoothing to car body
[Link].shade_smooth()
# Create car cabin
[Link].primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(0,
-9.7, 0.6))
car_cabin = [Link].active_object
car_cabin.name = "CarCabin"
car_cabin.scale = (0.7, 0.7, 0.2)
car_cabin.[Link](car_window_material)
# Add smoothing to car cabin
[Link].shade_smooth()
# Create car wheels
wheel_positions = [
(-0.5, -10.7, 0.2), # Front left
(0.5, -10.7, 0.2), # Front right
(-0.5, -9.3, 0.2), # Rear left
(0.5, -9.3, 0.2) # Rear right
]
wheels = []
for i, pos in enumerate(wheel_positions):
[Link].primitive_cylinder_add(
radius=0.2,
depth=0.1,
enter_editmode=False,
align='WORLD',
location=pos
)
wheel = [Link].active_object
[Link] = f"Wheel_{i+1}"
wheel.rotation_euler = (0, [Link]/2, 0)
[Link](wheel_material)
[Link](wheel)
# Add smoothing to wheels
[Link].shade_smooth()
# Create trees
def create_tree(location):
# Create trunk
[Link].primitive_cylinder_add(
radius=0.1,
depth=0.8,
enter_editmode=False,
align='WORLD',
location=(location[0], location[1], 0.4)
)
trunk = [Link].active_object
[Link] = f"TreeTrunk_{location[0]}_{location[1]}"
[Link](tree_trunk_material)
# Create leaves
[Link].primitive_cone_add(
radius1=0.3,
radius2=0,
depth=0.8,
enter_editmode=False,
align='WORLD',
location=(location[0], location[1], 1)
)
leaves = [Link].active_object
[Link] = f"TreeLeaves_{location[0]}_{location[1]}"
[Link](tree_leaves_material)
# Add smoothing to tree parts
[Link].select_all(action='DESELECT')
trunk.select_set(True)
leaves.select_set(True)
[Link].shade_smooth()
return [trunk, leaves]
# Create trees along the road
tree_positions_left = [(1.5, y, 0) for y in range(-10, 11, 2)]
tree_positions_right = [(-1.5, y, 0) for y in range(-10, 11, 2)]
trees = []
for pos in tree_positions_left + tree_positions_right:
[Link](create_tree(pos))
# Create a car parent object to make animation easier
[Link].empty_add(type='PLAIN_AXES', align='WORLD', location=(0, -10, 0))
car_parent = [Link].active_object
car_parent.name = "CarParent"
# Parent car parts to the empty
[Link].select_all(action='DESELECT')
car_body.select_set(True)
car_cabin.select_set(True)
for wheel in wheels:
wheel.select_set(True)
[Link].view_layer.[Link] = car_parent
[Link].parent_set(type='OBJECT')
# Setup animation for the car
scene = [Link]
scene.frame_start = 1
scene.frame_end = 120
scene.frame_current = 1
# Set cyclic animation
car_parent.animation_data_create()
car_parent.animation_data.action = [Link](name="CarAnimation")
# Initial location keyframe
car_parent.location = (0, -10, 0)
car_parent.keyframe_insert(data_path="location", frame=1)
# Final location keyframe
car_parent.location = (0, 10, 0)
car_parent.keyframe_insert(data_path="location", frame=120)
# Set interpolation to linear for smooth movement
for fc in car_parent.animation_data.[Link]:
for kf in fc.keyframe_points:
[Link] = 'LINEAR'
# Make the animation cyclic
[Link].use_preview_range = False
for fc in car_parent.animation_data.[Link]:
[Link] = 'CYCLIC'
# Create a sun light
[Link].light_add(type='SUN', radius=1, align='WORLD', location=(3, 0, 5))
sun = [Link].active_object
[Link] = "SunLight"
[Link] = 2.0
[Link] = (1.0, 0.95, 0.9)
sun.rotation_euler = ([Link](50), 0, [Link](20))
# Create a rim light for the car
[Link].light_add(type='AREA', radius=1, align='WORLD', location=(-2, 0, 3))
rim_light = [Link].active_object
rim_light.name = "RimLight"
rim_light.[Link] = 15.0
rim_light.[Link] = (0.9, 0.95, 1.0)
rim_light.rotation_euler = ([Link](90), 0, [Link](-90))
rim_light.[Link] = 5
# Create a fill light
[Link].light_add(type='AREA', radius=1, align='WORLD', location=(2, -5, 2))
fill_light = [Link].active_object
fill_light.name = "FillLight"
fill_light.[Link] = 8.0
fill_light.[Link] = (1.0, 1.0, 0.95)
fill_light.[Link] = 3
# Set up sky environment
world = [Link]
if not world:
world = [Link]("World")
[Link] = world
world.use_nodes = True
bg_node = world.node_tree.[Link]('Background')
bg_node.inputs['Color'].default_value = (0.7, 0.8, 1.0, 1.0) # Light blue sky
bg_node.inputs['Strength'].default_value = 1.0
# Add camera
[Link].camera_add(enter_editmode=False, align='VIEW', location=(3, -2, 2))
camera = [Link].active_object
[Link] = "MainCamera"
camera.rotation_euler = ([Link](60), 0, [Link](100))
# Set as active camera
[Link] = camera
# Set viewport to camera view
for area in [Link]:
if [Link] == 'VIEW_3D':
for space in [Link]:
if [Link] == 'VIEW_3D':
space.region_3d.view_perspective = 'CAMERA'
print("Road animation scene setup complete!")
Interactive 3D Solar System Prompt:
A 3D rotating solar system visualization with clickable planets that display details when hovered
over or clicked. Each planet orbits in real-time using CSS animations and JavaScript for
interactivity, make it visually appealing use html, css, js but in one html file