Okay, this is a fun challenge! Let's aim for something ethereal, abstract, and glowing – perhaps a "Cosmic Bloom" or "Nebula Heart."
This script will:
Create a central, complex, glowing object using icospheres and displacement.
Surround it with smaller, shimmering "particle" objects.
Use emissive materials with varied colors.
Set up dramatic lighting and a dark world background.
Add bloom via the compositor for that dreamy effect (works best in Eevee or Cycles with sufficient samples).
Include subtle animation.
Remember to run this script from Blender's Scripting tab.
python
import bpy
import math
import random
# --- Configuration ---
NUM_MAIN_LAYERS = 3 # Number of layers for the central object
MAIN_OBJECT_SCALE_FACTOR = 0.7 # How much smaller each inner layer is
DISPLACEMENT_STRENGTH = 0.5
NUM_PARTICLES = 150
PARTICLE_SPAWN_RADIUS = 8.0
ANIMATION_FRAMES = 250
USE_EEVEE_BLOOM = True # If False, uses Cycles compositor bloom (slower but often higher quality)
RENDER_ENGINE = 'EEVEE' # 'CYCLES' or 'EEVEE'
# --- Helper Functions ---
def clear_scene():
"""Clears all objects, materials, and textures from the scene."""
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
for material in bpy.data.materials:
bpy.data.materials.remove(material)
for texture in bpy.data.textures:
bpy.data.textures.remove(texture)
for light in bpy.data.lights:
bpy.data.lights.remove(light)
# Clear compositor nodes
if bpy.context.scene.use_nodes:
bpy.context.scene.node_tree.nodes.clear()
def create_glowing_material(name, base_color_rgb, emission_strength):
"""Creates a new material with emission."""
mat = bpy.data.materials.new(name=name)
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
# Clear default nodes
for node in nodes:
nodes.remove(node)
# Create Emission node
emission_node = nodes.new(type='ShaderNodeEmission')
emission_node.inputs['Color'].default_value = (*base_color_rgb, 1.0) # RGBA
emission_node.inputs['Strength'].default_value = emission_strength
# Create Output node
output_node = nodes.new(type='ShaderNodeOutputMaterial')
# Link Emission to Output
links.new(emission_node.outputs['Emission'], output_node.inputs['Surface'])
return mat
def create_complex_material(name, color1_rgb, color2_rgb, emission_strength_base):
"""Creates a material that mixes two colors and has emission, influenced by noise."""
mat = bpy.data.materials.new(name=name)
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
for node in nodes: nodes.remove(node) # Clear default
# Texture Coordinate
tex_coord = nodes.new(type='ShaderNodeTexCoord')
# Noise Texture
noise_tex = nodes.new(type='ShaderNodeTexNoise')
noise_tex.inputs['Scale'].default_value = random.uniform(2.0, 5.0)
noise_tex.inputs['Detail'].default_value = random.uniform(4.0, 10.0)
noise_tex.inputs['Roughness'].default_value = random.uniform(0.5, 0.8)
noise_tex.inputs['Distortion'].default_value = random.uniform(0.1, 0.5)
links.new(tex_coord.outputs['Generated'], noise_tex.inputs['Vector'])
# Color Ramp for mixing
color_ramp_mix = nodes.new(type='ShaderNodeValToRGB') # ColorRamp
color_ramp_mix.color_ramp.elements[0].color = (*color1_rgb, 1)
color_ramp_mix.color_ramp.elements[1].color = (*color2_rgb, 1)
color_ramp_mix.color_ramp.elements.new(position=random.uniform(0.3, 0.7))
color_ramp_mix.color_ramp.elements[1].position = random.uniform(0.4, 0.6) # ensure it's a distinct band
links.new(noise_tex.outputs['Fac'], color_ramp_mix.inputs['Fac'])
# Emission
emission_node = nodes.new(type='ShaderNodeEmission')
emission_node.inputs['Strength'].default_value = emission_strength_base * random.uniform(0.8, 1.5)
links.new(color_ramp_mix.outputs['Color'], emission_node.inputs['Color'])
# Principled BSDF (for some subtle surface properties, optional)
# principled_bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')
# principled_bsdf.inputs['Base Color'].default_value = (0.05, 0.05, 0.05, 1) # Dark base
# principled_bsdf.inputs['Roughness'].default_value = 0.8
# links.new(noise_tex.outputs['Fac'], principled_bsdf.inputs['Metallic']) # Interesting effect
# Mix Shader (Emission with BSDF) - optional, for more substance
# mix_shader = nodes.new(type='ShaderNodeMixShader')
# links.new(noise_tex.outputs['Color'], mix_shader.inputs['Fac']) # Use noise color to mix
# links.new(emission_node.outputs['Emission'], mix_shader.inputs[1])
# links.new(principled_bsdf.outputs['BSDF'], mix_shader.inputs[2])
# Output
output_node = nodes.new(type='ShaderNodeOutputMaterial')
# links.new(mix_shader.outputs['Shader'], output_node.inputs['Surface']) # If using mix
links.new(emission_node.outputs['Emission'], output_node.inputs['Surface']) # If just emission
return mat
def setup_compositor_bloom():
"""Sets up bloom in the compositor (good for Cycles or if Eevee bloom isn't enough)."""
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree
for node in tree.nodes: # Clear existing
tree.nodes.remove(node)
render_layers_node = tree.nodes.new(type='CompositorNodeRLayers')
glare_node = tree.nodes.new(type='CompositorNodeGlare')
composite_node = tree.nodes.new(type='CompositorNodeComposite')
glare_node.glare_type = 'FOG_GLOW'
glare_node.threshold = 0.5 # Lower for more bloom
glare_node.mix = 0.0 # 0 for additive bloom, -1 for screen, 1 for replace
glare_node.size = 9 # Size of the glow
glare_node.quality = 'HIGH'
tree.links.new(render_layers_node.outputs['Image'], glare_node.inputs['Image'])
tree.links.new(glare_node.outputs['Image'], composite_node.inputs['Image'])
# --- Main Script ---
def create_vision():
clear_scene()
# --- World Setup ---
world = bpy.context.scene.world
if world is None:
world = bpy.data.worlds.new("DarkWorld")
bpy.context.scene.world = world
world.use_nodes = True
bg_node = world.node_tree.nodes.get('Background')
if bg_node:
bg_node.inputs['Color'].default_value = (0.0, 0.0, 0.0, 1.0) # Black
bg_node.inputs['Strength'].default_value = 0.05 # Very dim
# --- Render Settings ---
scene = bpy.context.scene
scene.render.engine = RENDER_ENGINE
if RENDER_ENGINE == 'EEVEE':
scene.eevee.use_bloom = USE_EEVEE_BLOOM
if USE_EEVEE_BLOOM:
scene.eevee.bloom_threshold = 0.8
scene.eevee.bloom_intensity = 0.1 # Can be subtle, compositor helps
scene.eevee.bloom_radius = 6.5
scene.eevee.use_ssr = True # Screen Space Reflections
elif RENDER_ENGINE == 'CYCLES':
scene.cycles.samples = 128 # Adjust for quality/speed
scene.cycles.use_denoising = True
if not USE_EEVEE_BLOOM: # Use compositor if Eevee bloom is off
setup_compositor_bloom()
if not USE_EEVEE_BLOOM and RENDER_ENGINE != 'CYCLES': # if Eevee but Eevee bloom off, use compositor
setup_compositor_bloom()
# --- Central Object ---
main_obj_base_scale = 2.0
main_obj_prev = None
# Define a color palette
palette = [
(0.1, 0.3, 0.9), # Deep Blue
(0.5, 0.1, 0.8), # Purple
(0.9, 0.2, 0.5), # Magenta/Pink
(0.2, 0.8, 0.7), # Teal
(1.0, 0.5, 0.1) # Orange/Gold
]
central_object_group = bpy.data.collections.new("CentralObjects")
bpy.context.scene.collection.children.link(central_object_group)
for i in range(NUM_MAIN_LAYERS):
current_scale = main_obj_base_scale * (MAIN_OBJECT_SCALE_FACTOR ** i)
bpy.ops.mesh.primitive_ico_sphere_add(subdivisions=4, radius=current_scale, location=(0, 0, 0))
obj = bpy.context.active_object
central_object_group.objects.link(obj)
bpy.context.collection.objects.unlink(obj) # Unlink from scene master collection
# Add modifiers
bpy.ops.object.modifier_add(type='SUBSURF')
obj.modifiers["Subdivision"].levels = 1
obj.modifiers["Subdivision"].render_levels = 2
disp_mod = obj.modifiers.new(name="Displace", type='DISPLACE')
noise_tex = bpy.data.textures.new(name=f"DispNoise_{i}", type='CLOUDS')
noise_tex.noise_scale = random.uniform(0.3, 0.8)
noise_tex.noise_depth = random.randint(1, 3)
disp_mod.texture = noise_tex
disp_mod.strength = DISPLACEMENT_STRENGTH * (1.0 - i * 0.2) # Less displacement for inner layers
disp_mod.mid_level = 0
bpy.ops.object.shade_smooth()
# Material
color1 = random.choice(palette)
color2 = random.choice([c for c in palette if c != color1]) # Ensure different second color
mat = create_complex_material(f"CentralMat_{i}", color1, color2, random.uniform(10, 30))
obj.data.materials.append(mat)
# Animation (simple rotation)
obj.rotation_euler.z = random.uniform(0, math.pi * 2)
obj.keyframe_insert(data_path="rotation_euler", frame=1)
obj.rotation_euler.z += random.choice([-1, 1]) * math.pi * (0.5 + i*0.1) # Different speeds
obj.keyframe_insert(data_path="rotation_euler", frame=ANIMATION_FRAMES)
# Set cyclic animation for rotation
for fcurve in obj.animation_data.action.fcurves:
if fcurve.data_path == "rotation_euler":
for kf_point in fcurve.keyframe_points:
kf_point.interpolation = 'LINEAR' # or 'BEZIER'
mod = fcurve.modifiers.new('CYCLES')
if main_obj_prev:
# Could add constraints or parenting here if desired
pass
main_obj_prev = obj
# --- "Particle" Objects ---
particle_collection = bpy.data.collections.new("Particles")
bpy.context.scene.collection.children.link(particle_collection)
for i in range(NUM_PARTICLES):
bpy.ops.mesh.primitive_uv_sphere_add(segments=12, ring_count=6, radius=random.uniform(0.02, 0.1))
p_obj = bpy.context.active_object
particle_collection.objects.link(p_obj)
bpy.context.collection.objects.unlink(p_obj)
# Random position in a sphere
phi = random.uniform(0, math.pi * 2)
costheta = random.uniform(-1, 1)
theta = math.acos(costheta)
r = PARTICLE_SPAWN_RADIUS * (random.uniform(0.3, 1.0) ** 0.5) # bias towards center
x = r * math.sin(theta) * math.cos(phi)
y = r * math.sin(theta) * math.sin(phi)
z = r * math.cos(theta)
p_obj.location = (x, y, z)
bpy.ops.object.shade_smooth()
# Particle Material
p_color = random.choice(palette)
p_mat = create_glowing_material(f"ParticleMat_{i}", p_color, random.uniform(5, 20))
p_obj.data.materials.append(p_mat)
# Subtle animation for particles (e.g., floating or flickering)
p_obj.keyframe_insert(data_path="location", frame=1)
p_obj.location.x += random.uniform(-0.5, 0.5)
p_obj.location.y += random.uniform(-0.5, 0.5)
p_obj.location.z += random.uniform(-0.5, 0.5)
p_obj.keyframe_insert(data_path="location", frame=ANIMATION_FRAMES // 2)
p_obj.location = (x,y,z) # Return to origin or new random spot
p_obj.keyframe_insert(data_path="location", frame=ANIMATION_FRAMES)
for fcurve in p_obj.animation_data.action.fcurves:
if fcurve.data_path == "location":
for kf_point in fcurve.keyframe_points:
kf_point.interpolation = 'BEZIER'
mod = fcurve.modifiers.new('CYCLES')
# --- Lighting ---
# A gentle area light for some definition if needed, but emission is key
bpy.ops.object.light_add(type='AREA', radius=5, location=(0, 0, PARTICLE_SPAWN_RADIUS + 2))
light_obj = bpy.context.active_object
light_data = light_obj.data
light_data.energy = random.uniform(100, 300) # Watts for Area light
light_data.color = random.choice(palette)
light_data.shape = 'DISK'
# --- Camera Setup ---
bpy.ops.object.camera_add(location=(0, -PARTICLE_SPAWN_RADIUS * 1.2, PARTICLE_SPAWN_RADIUS * 0.3))
camera_obj = bpy.context.active_object
bpy.context.scene.camera = camera_obj
# Point camera towards origin (or a specific target)
# Create an empty to look at
bpy.ops.object.empty_add(type='PLAIN_AXES', location=(0, 0, 0))
look_at_target = bpy.context.active_object
look_at_target.name = "CameraTarget"
constraint = camera_obj.constraints.new(type='TRACK_TO')
constraint.target = look_at_target
constraint.track_axis = 'TRACK_NEGATIVE_Z'
constraint.up_axis = 'UP_Y'
camera_data = camera_obj.data
camera_data.lens = random.uniform(35, 70) # Focal length
camera_data.dof.use_dof = True
camera_data.dof.focus_object = look_at_target # Focus on the target
camera_data.dof.aperture_fstop = random.uniform(0.5, 1.8) # For shallow depth of field
# Camera animation (optional subtle pan or zoom)
camera_obj.keyframe_insert(data_path="location", frame=1)
# camera_obj.location.y -= 2 # Simple dolly out
# camera_obj.location.z += 1
camera_obj.rotation_euler.z = 0
camera_obj.keyframe_insert(data_path="rotation_euler", frame=1)
camera_obj.rotation_euler.z = math.radians(random.uniform(-15,15)) # Slight pan
camera_obj.keyframe_insert(data_path="rotation_euler", frame=ANIMATION_FRAMES)
for fcurve in camera_obj.animation_data.action.fcurves:
if fcurve.data_path == "rotation_euler":
for kf_point in fcurve.keyframe_points:
kf_point.interpolation = 'BEZIER'
# No cyclic for camera pan usually
# --- Animation Settings ---
scene.frame_start = 1
scene.frame_end = ANIMATION_FRAMES
print("Beautiful Vision script finished generating scene!")
print(f"Using {RENDER_ENGINE} with bloom {'enabled via Eevee settings' if RENDER_ENGINE == 'EEVEE' and USE_EEVEE_BLOOM else 'via Compositor (or Eevee default if Eevee bloom is on)'}.")
# --- Run the Creation ---
if __name__ == "__main__":
create_vision()
How to Use & Understand:
Open Blender.
Go to the Scripting tab.
Click "New" to create a new text block.
Copy and paste the entire script into the text block.
Save the script (optional, but good practice: Text > Save As...).
Click the "Run Script" button (the play icon).
What the Script Does & Customization:
clear_scene(): Starts with a blank slate.
Configuration: At the top, you can easily change:
NUM_MAIN_LAYERS: More layers make the central object more intricate.
MAIN_OBJECT_SCALE_FACTOR: Controls how much smaller inner layers are.
DISPLACEMENT_STRENGTH: How much the surface of the main object is distorted.
NUM_PARTICLES: Number of small glowing orbs.
PARTICLE_SPAWN_RADIUS: How far out the particles can spawn.
ANIMATION_FRAMES: Length of the animation.
USE_EEVEE_BLOOM: Set to False if you prefer the Compositor bloom (often better quality, especially with Cycles, but can be slower to render preview). If True and RENDER_ENGINE is 'EEVEE', it uses Eevee's built-in bloom.
These functions set up shader nodes for emissive materials.
The create_complex_material uses a Noise texture to vary color and emission, creating a more organic, nebula-like feel.
A palette of colors is defined, and colors are chosen randomly from it. Feel free to change these colors!
Central Object:
Multiple scaled icospheres are layered.
Each gets Subdivision Surface (for smoothness) and Displacement (for organic, bumpy shapes using a procedural "Clouds" texture).
They rotate at different speeds.
Particle Objects:
Simple UV spheres scattered randomly in a larger sphere.
They have their own glowing materials and subtle floating animation.
Lighting & World:
The world background is set to black to make the emission pop.
A single Area light is added for a bit of fill, but the main illumination comes from the objects themselves.
Camera:
Positioned to view the scene.
Uses Depth of Field (DOF) to create a blurry background/foreground, focusing on the center.
Has a slight panning animation.
Bloom:
To See the Vision:
After running the script, switch to the Layout tab.
Change your viewport shading to "Rendered" (the sphere icon at the top-right of the 3D viewport).
Press Spacebar (or the play button on the timeline at the bottom) to play the animation.
To render a still image: Render > Render Image (F12).
To render the animation: Render > Render Animation (Ctrl+F12). (Make sure to set an output path in Output Properties first!).
This script provides a good foundation. You can experiment wildly by changing parameters, adding more modifiers, tweaking the shader node setups, or even introducing completely different types of geometry! Have fun creating your unique vision!
If RENDER_ENGINE is 'EEVEE' and USE_EEVEE_BLOOM is True, Eevee's native bloom is activated.
Otherwise (or if USE_EEVEE_BLOOM is False), compositor nodes are set up to create a "Fog Glow" effect, which is essential for the "beautiful vision" feel.