Claude 3.
7 Prompts & Python code By Nissam
Our AI Tools Directory: www.aidizer.com
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: item.attr = 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
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
# Set render engine to Eevee Next and enable bloom
bpy.context.scene.render.engine = 'BLENDER_EEVEE_NEXT'
bpy.context.scene.eevee.use_bloom = True
bpy.context.scene.eevee.bloom_intensity = 0.05
bpy.context.scene.eevee.bloom_threshold = 1.0
# Create materials
def create_material(name, base_color, metallic=0.0, roughness=0.5, specular=0.5):
material = bpy.data.materials.new(name)
material.use_nodes = True
bsdf = material.node_tree.nodes.get('Principled BSDF')
bsdf.inputs['Base Color'].default_value = base_color
bsdf.inputs['Metallic'].default_value = metallic
bsdf.inputs['Roughness'].default_value = roughness
if 'Specular IOR Level' in bsdf.inputs:
bsdf.inputs['Specular IOR Level'].default_value = specular
elif 'Specular' in bsdf.inputs:
bsdf.inputs['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
bpy.ops.mesh.primitive_plane_add(size=1, enter_editmode=False, align='WORLD', location=(0,
0, 0))
road = bpy.context.active_object
road.name = "Road"
road.scale = (2, 15, 1)
road.data.materials.append(road_material)
# Create road markings
bpy.ops.mesh.primitive_plane_add(size=1, enter_editmode=False, align='WORLD', location=(0,
0, 0.01))
road_marking = bpy.context.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.data.materials.append(road_marking_material)
# Create car body
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(0,
-10, 0.3))
car_body = bpy.context.active_object
car_body.name = "CarBody"
car_body.scale = (0.8, 1.2, 0.25)
car_body.data.materials.append(car_body_material)
# Add smoothing to car body
bpy.ops.object.shade_smooth()
# Create car cabin
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(0,
-9.7, 0.6))
car_cabin = bpy.context.active_object
car_cabin.name = "CarCabin"
car_cabin.scale = (0.7, 0.7, 0.2)
car_cabin.data.materials.append(car_window_material)
# Add smoothing to car cabin
bpy.ops.object.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):
bpy.ops.mesh.primitive_cylinder_add(
radius=0.2,
depth=0.1,
enter_editmode=False,
align='WORLD',
location=pos
)
wheel = bpy.context.active_object
wheel.name = f"Wheel_{i+1}"
wheel.rotation_euler = (0, math.pi/2, 0)
wheel.data.materials.append(wheel_material)
wheels.append(wheel)
# Add smoothing to wheels
bpy.ops.object.shade_smooth()
# Create trees
def create_tree(location):
# Create trunk
bpy.ops.mesh.primitive_cylinder_add(
radius=0.1,
depth=0.8,
enter_editmode=False,
align='WORLD',
location=(location[0], location[1], 0.4)
)
trunk = bpy.context.active_object
trunk.name = f"TreeTrunk_{location[0]}_{location[1]}"
trunk.data.materials.append(tree_trunk_material)
# Create leaves
bpy.ops.mesh.primitive_cone_add(
radius1=0.3,
radius2=0,
depth=0.8,
enter_editmode=False,
align='WORLD',
location=(location[0], location[1], 1)
)
leaves = bpy.context.active_object
leaves.name = f"TreeLeaves_{location[0]}_{location[1]}"
leaves.data.materials.append(tree_leaves_material)
# Add smoothing to tree parts
bpy.ops.object.select_all(action='DESELECT')
trunk.select_set(True)
leaves.select_set(True)
bpy.ops.object.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:
trees.extend(create_tree(pos))
# Create a car parent object to make animation easier
bpy.ops.object.empty_add(type='PLAIN_AXES', align='WORLD', location=(0, -10, 0))
car_parent = bpy.context.active_object
car_parent.name = "CarParent"
# Parent car parts to the empty
bpy.ops.object.select_all(action='DESELECT')
car_body.select_set(True)
car_cabin.select_set(True)
for wheel in wheels:
wheel.select_set(True)
bpy.context.view_layer.objects.active = car_parent
bpy.ops.object.parent_set(type='OBJECT')
# Setup animation for the car
scene = bpy.context.scene
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 = bpy.data.actions.new(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.action.fcurves:
for kf in fc.keyframe_points:
kf.interpolation = 'LINEAR'
# Make the animation cyclic
bpy.context.scene.use_preview_range = False
for fc in car_parent.animation_data.action.fcurves:
fc.extrapolation = 'CYCLIC'
# Create a sun light
bpy.ops.object.light_add(type='SUN', radius=1, align='WORLD', location=(3, 0, 5))
sun = bpy.context.active_object
sun.name = "SunLight"
sun.data.energy = 2.0
sun.data.color = (1.0, 0.95, 0.9)
sun.rotation_euler = (math.radians(50), 0, math.radians(20))
# Create a rim light for the car
bpy.ops.object.light_add(type='AREA', radius=1, align='WORLD', location=(-2, 0, 3))
rim_light = bpy.context.active_object
rim_light.name = "RimLight"
rim_light.data.energy = 15.0
rim_light.data.color = (0.9, 0.95, 1.0)
rim_light.rotation_euler = (math.radians(90), 0, math.radians(-90))
rim_light.data.size = 5
# Create a fill light
bpy.ops.object.light_add(type='AREA', radius=1, align='WORLD', location=(2, -5, 2))
fill_light = bpy.context.active_object
fill_light.name = "FillLight"
fill_light.data.energy = 8.0
fill_light.data.color = (1.0, 1.0, 0.95)
fill_light.data.size = 3
# Set up sky environment
world = bpy.context.scene.world
if not world:
world = bpy.data.worlds.new("World")
bpy.context.scene.world = world
world.use_nodes = True
bg_node = world.node_tree.nodes.get('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
bpy.ops.object.camera_add(enter_editmode=False, align='VIEW', location=(3, -2, 2))
camera = bpy.context.active_object
camera.name = "MainCamera"
camera.rotation_euler = (math.radians(60), 0, math.radians(100))
# Set as active camera
bpy.context.scene.camera = camera
# Set viewport to camera view
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces:
if space.type == '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