🔍

generative geometry experiments

simple generative object made from primitives


abstract object sculpture fur, crystal, glass. white plain background.


import bpy
import random
import math

def create_random_primitive(location, rotation, scale):
    obj = None
    shape = random.choice(['cube', 'sphere', 'cylinder', 'pyramid'])
    
    if shape == 'cube':
        bpy.ops.mesh.primitive_cube_add(size=1, location=location, rotation=rotation)
    elif shape == 'sphere':
        bpy.ops.mesh.primitive_uv_sphere_add(radius=0.25, location=location, rotation=rotation)
    elif shape == 'cylinder':
        bpy.ops.mesh.primitive_cylinder_add(radius=0.25, depth=1, location=location, rotation=rotation)
    elif shape == 'pyramid':
        bpy.ops.mesh.primitive_cone_add(radius1=0.25, radius2=0, depth=1, location=location, rotation=rotation)
    
    obj = bpy.context.object
    obj.scale = scale
    return obj

def generate_primitives(count=30, min_dist=1.0):
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()  # Löscht alle vorhandenen Objekte
    
    objects = []
    for _ in range(count):
        
        # Zufällige Position in einem begrenzten Bereich
        x = random.uniform(-2, 2)
        y = random.uniform(-2, 2)
        z = random.uniform(-2, 2)
        
        # Zufällige Rotation
        rot_x = round(random.uniform(0,  4)) * math.pi * .5
        rot_y = round(random.uniform(0,  4)) * math.pi * .5
        rot_z = round(random.uniform(0,  4)) * math.pi * .5
        
        # Zufällige Skalierung
        scale_x = random.uniform(0.5, 2.0)
        scale_y = random.uniform(0.5, 2.0)
        scale_z = random.uniform(0.5, 3.0)
        
        obj = create_random_primitive((x, y, z), (rot_x, rot_y, rot_z), (scale_x, scale_y, scale_z))
        objects.append(obj)
        
    return objects

# Generiere 30 zufällige Primitive
generate_primitives(30)


abstract beautiful minimalistic sculpture withfuturistic interface made from realistic beautiful smooth detailed human young skin with tiny fine slight wrinkles and pores and fine black hair, buldges, crystal, glass and white glossy wires. white plain background.