Menu

Sand3D Organic

3D library of 10K organic assetsopen source and written as code3D library of10K organic assetsopen source andwritten as code

A dataset of organic 3D assets: trees, flowers, fungi, rocks and corals.
The Sand3D language also grows organic detail on assets you already have.
An organic 3D dataset. Sand3D also grows organic detail on assets you already have.

Sand3D

One program per asset. A Python file that grows each part:
trunk, branches, leaves, petals and moss.

Change the style. One argument for the look, every asset in place.

Predefined seasons. Reuse the same assets for every time of year.

Lit by the scene. Light sources are built in, ready for night scenes.

Species by name. Call any plant by its name and fill a scene fast.

One program, every season

Each asset grows from a short program a person can read and an LLM can learn from.

  • Species asa parameter

    One function per plant family, the species picked by name.

  • Any look,same shapes

    The style is one argument among the program’s parameters.

  • Every seasonfrom one line

    Set season to winter and the garden gets its snow.

  • Fully open-sourced library

    Programs on Hugging Face, the library on GitHub, all open.

Every assetcomes with its program

Every part has its name in the code. Change a value, run the program again, and the plant follows.

Bamboo bridge, rendered from its program

bamboo_bridge.py156 lines

import sand3d as s3dimport numpy as npimport randomimport math def toy_bamboo_footbridge(seed=0):    span, width, rise, spring = (6100, 2150, 520, 550)    arch = (span, rise, spring)    feet = entrance_feet(arch, width, seed=seed + 1)    trestles = entrance_trestles(arch, width, seed=seed + 2)    beams = arched_longitudinal_beams(arch, width, seed=seed + 3)    deck = transverse_deck_poles(arch, width, seed=seed + 4)    posts = railing_posts(arch, width, seed=seed + 5)    hands = arched_handrails(arch, width, seed=seed + 6)    greens = secondary_side_rails(arch, width, seed=seed + 7)    ropes = rope_lashings(arch, width, seed=seed + 8)    return s3d.assembly('toy_bamboo_footbridge', feet, trestles, beams, deck, posts, hands, greens, ropes) def entrance_feet(arch, width, seed=0, diameter=320, inset=300, overhang=145):    span, rise, spring = arch    pole = culm_nodes_and_end_caps('broad_bamboo_sleeper', width + overhang * 2, diameter, seed, False, True)    one = s3d.at(pole, x=span / 2 - inset, y=width / 2 + overhang, z=diameter * 1.065 / 2, rx=90)    twin = s3d.transform(s3d.copy(one), mirror='x')    return s3d.group('entrance_feet', one, twin) def culm_nodes_and_end_caps(name, length=2150, diameter=135, seed=0, green=False, horizontal=True, node_pitch=540):    rng = random.Random(seed)    radius = diameter / 2    count = max(1, int(length / node_pitch))    positions = [(i + 0.55 + rng.uniform(-0.12, 0.12)) * length / count for i in range(count)]    half_node = diameter * 0.12    contour = [(0, 0), (radius * 0.73, 0), (radius * 0.96, radius * 0.12), (radius, radius * 0.35)]    for z in positions:        if radius < z < length - radius:            contour += [(radius, z - half_node), (radius * 1.065, z - half_node * 0.35), (radius * 1.065, z + half_node * 0.35), (radius, z + half_node)]    contour += [(radius, length - radius * 0.35), (radius * 0.96, length - radius * 0.12), (radius * 0.73, length), (0, length)]    with s3d.facets(12, smooth=True):        pole = s3d.revolve(name, s3d.poly(contour))    s3d.smooth(pole, 75)    s3d.material(pole, 'leaf' if green else 'oak', color=bamboo_finish(seed, green, up=1 if horizontal else 2, nodes=positions), roughness=0.44)    return pole def bamboo_finish(seed=0, green=False, axis='z', up=2, nodes=()):    tint = np.array([0.5, 0.67, 0.2] if green else [0.79, 0.52, 0.18])    pale = np.array([0.73, 0.83, 0.35] if green else [0.94, 0.72, 0.34])    amber = np.array([0.27, 0.43, 0.1] if green else [0.61, 0.34, 0.1])     def color(x, y, z, n):        coord = x if axis == 'x' else z        orientation = np.clip(n[up] * 0.5 + 0.5, 0, 1)        base = amber + (pale - amber) * orientation[..., None]        grain = 0.025 * np.sin(coord / 131 + seed) + 0.018 * np.sin((x + y + z) / 47 + seed)        base = base * 0.82 + tint * 0.18 + grain[..., None]        ring = np.zeros_like(coord, dtype=bool)        for node in nodes:            ring = ring | (np.abs(coord - node) < 6)        return np.clip(base * np.where(ring, 0.76, 1)[..., None], 0, 1)    return color def entrance_trestles(arch, width, seed=0, inset=300, bearing_d=145, leg_d=180, foot_d=320):    span, rise, spring = arch    x = span / 2 - inset    z = arch_height(x, arch) - bearing_d    bearing = s3d.at(culm_nodes_and_end_caps('cross_bearing', width, bearing_d, seed, True, True), x=x, y=width / 2, z=z, rx=90)    leg = culm_nodes_and_end_caps('short_trestle_leg', z - foot_d + leg_d / 2, leg_d, seed + 1, False, False)    pair = s3d.at(leg, on=s3d.grid(1, 2, py=width * 0.78), x=x, z=foot_d - leg_d / 2)    end = s3d.group('entrance_trestle', bearing, pair)    twin = s3d.transform(s3d.copy(end), mirror='x')    return s3d.group('entrance_trestles', end, twin) def arch_height(x, arch):    span, rise, spring = arch    return spring + rise * (1 - (2 * x / span) ** 2) def arched_longitudinal_beams(arch, width, seed=0, diameter=200):    ys = (-width * 0.39, 0, width * 0.39)    beams = [curved_culm('arched_load_bearing_bamboo', arch, y=y, diameter=diameter, seed=seed + i) for i, y in enumerate(ys)]    return s3d.group('arched_longitudinal_beams', beams) def curved_culm(name, arch, y=0, lift=0, diameter=180, seed=0, green=False, length_ratio=1):    span, rise, spring = arch    rng = random.Random(seed)    half = span * length_ratio / 2    with s3d.facets(12, smooth=True):        points = [(x, y, arch_height(x, arch) + lift) for x in np.linspace(-half, half, 9)]        path = s3d.spline(points)        count = 10        us = [(i + 0.5 + rng.uniform(-0.13, 0.13)) / count for i in range(count)]        law = [(0, 0), (0.01, diameter)]        for u in us:            law += [(u - 0.004, diameter), (u, diameter * 1.065), (u + 0.004, diameter)]        law += [(0.99, diameter), (1, 0)]        pole = s3d.wire(name, path, d=law)    nodes = [-half + 2 * half * u for u in us]    s3d.material(pole, 'leaf' if green else 'oak', color=bamboo_finish(seed, green, axis='x', nodes=nodes), roughness=0.43)    return pole def transverse_deck_poles(arch, width, seed=0, count=37, diameter=135, margin=90, beam_d=200):    span, rise, spring = arch    frames = s3d.grid(count, px=(span - 2 * margin) / (count - 1))    rng = random.Random(seed)    poles = []    for i, f in enumerate(frames):        x = f.origin.x + rng.uniform(-3, 3)        d = diameter * rng.uniform(0.97, 1.03)        pole = culm_nodes_and_end_caps('walking_surface_culm', width, d, seed + 100 + i, green=i % 11 == 3)        pole = s3d.bend(pole, rng.uniform(-1.4, 1.4), axis='+Z', toward='+X', step=0)        poles.append(s3d.at(pole, x=x, y=width / 2, z=arch_height(x, arch) + beam_d / 2 + d / 2, rx=90, rz=rng.uniform(-0.3, 0.3)))    return s3d.group('transverse_deck_poles', poles) def railing_posts(arch, width, seed=0, count=5, inset=350, diameter=135, rail_lift=1230):    span, rise, spring = arch    frames = s3d.grid(count, px=(span - 2 * inset) / (count - 1))    posts = []    for i, f in enumerate(frames):        x = f.origin.x        post = culm_nodes_and_end_caps('upright_bamboo_post', rail_lift + diameter * 0.28, diameter * (1.08 if i in (0, count - 1) else 1), seed + i, horizontal=False, node_pitch=410)        post = s3d.at(post, x=x, y=-width * 0.435, z=arch_height(x, arch) - diameter * 0.15)        posts += [post, s3d.transform(s3d.copy(post), mirror='y')]    return s3d.group('railing_posts', posts) def arched_handrails(arch, width, seed=0, diameter=145, lift=1230):    rail = curved_culm('rounded_honey_handrail', arch, y=-width * 0.435, lift=lift, diameter=diameter, seed=seed)    return s3d.group('arched_handrails', rail, s3d.transform(s3d.copy(rail), mirror='y')) def secondary_side_rails(arch, width, seed=0, diameter=85, lift=690, inset=280):    rail = curved_culm('fresh_green_middle_rail', arch, y=-width * 0.435, lift=lift, diameter=diameter, seed=seed, green=True, length_ratio=1 - 2 * inset / arch[0])    return s3d.group('secondary_side_rails', rail, s3d.transform(s3d.copy(rail), mirror='y')) def rope_lashings(arch, width, seed=0, count=5, inset=350, rope_d=23):    span, rise, spring = arch    frames = s3d.grid(count, px=(span - 2 * inset) / (count - 1))    lashings = []    for i, f in enumerate(frames):        x = f.origin.x        for j, (lift, diameter) in enumerate(((1230, 145), (690, 85), (0, 200))):            knot = cross_lashing('tan_rope_turns', diameter=diameter, rope_d=rope_d, seed=seed + i * 3 + j)            knot = s3d.at(knot, on=lashing_frame(arch, x, -width * 0.435, lift))            lashings += [knot, s3d.transform(s3d.copy(knot), mirror='y')]    return s3d.group('rope_lashings', lashings) def cross_lashing(name, diameter=145, post_d=135, rope_d=23, turns=3, seed=0):    radius = diameter / 2 + rope_d * 0.7    reach = post_d / 2 + rope_d * 0.7    with s3d.facets(6, smooth=True):        path = s3d.spline([(0, -reach, 0), (0, -reach * 0.8, radius), (0, 0, radius), (0, reach * 0.8, radius), (0, reach, 0), (0, reach * 0.8, -radius), (0, 0, -radius), (0, -reach * 0.8, -radius)], loop=True)        turn = s3d.wire(name, path, rope_d)        s3d.material(turn, 'fabric', color='#a18359' if seed % 2 else '#ac8d60', roughness=0.93)        wraps = s3d.at(turn, on=s3d.grid(turns, px=rope_d * 1.15))        cinch = s3d.wire('diagonal_rope_cinch', [(-rope_d * 2, -reach - rope_d, -radius * 0.8), (rope_d * 2, -reach - rope_d, radius * 0.8)], rope_d * 0.85)        s3d.material(cinch, 'fabric', color='#c2a16e', roughness=0.95)    return s3d.group('rope_cross_lashing', wraps, cinch) def lashing_frame(arch, x, y, lift):    slope = -8 * arch[1] * x / (arch[0] * arch[0])    return s3d.Frame((x, y, arch_height(x, arch) + lift)).turn(ry=-math.degrees(math.atan(slope)))

The most diverse organic 3D-as-code library

10,000

288 organic assets, rendered side by side

You want more?

100K Assets 3D Libraryopen source and written as code

Discover an open source 3D-as-code library of 100K assets.

  • Golf cart
  • Coffee grinder
  • Lounge chair
  • Lighthouse
  • Ferris wheel
  • Toy train
  • Candy machine
  • Excavator
  • Telephone box
  • Hot dog cart
  • Forklift
  • Food truck
A coral reef of Sand3D Organic assets, swaying under rippling light

Open source on Hugging Face

The organic dataset on Hugging Face, and the Sand3D library that runs its programs on GitHub.