← atelier

landing/art/hero_objects.py

Hero: five raymarched objects, each rendered alone with alpha so the page can float them in parallax.

Render it yourself: atelier render hero_objects.py --preview (it imports _common.py for the palette and output folder).

hero_objects.py
# Hero: five raymarched objects, each rendered alone with alpha so the page can float them in parallax.
import numpy as np
from atelier import *
from _common import *

S = 800
c = Canvas(S * 5, S)

def lit(scene):
    scene.area(pos=(-2.6, 3.0, 2.4), size=(2.2, 2.2), normal=(0.6, -0.7, -0.5), color="#fff0da", power=34)
    scene.area(pos=(3.0, 0.5, -1.5), size=(1.5, 3), normal=(-1, 0, 0.5), color="#5ec8c0", power=10)   # teal rim light
    scene.sky("#1d2740", "#8a6a50", "#0e0b08", power=0.55)
    scene.camera((0, 0.25, 3.4), (0, 0, 0), fov=38)
    return scene

objs = []
s = Scene()                                                                      # gold torus, tilted
s.add(torus(0.78, 0.24).rotate(x=68, z=-22), Mat(GOLD, rough=0.18, metal=1))
objs.append(s)
s = Scene()                                                                      # vermilion satin sphere
s.add(sphere(0.9), Mat(VERMILION, rough=0.28, sss=0.35, sss_color="#ff9a70"))
objs.append(s)
s = Scene()                                                                      # glazed cream vase (lathe profile)
vase = lathe([(0.0, 0.0), (0.42, 0.02), (0.6, 0.35), (0.5, 0.8), (0.24, 1.15), (0.22, 1.4), (0.32, 1.55)], thickness=0.04)
s.add(vase.move(0, -0.8, 0).rotate(z=-12, x=14), Mat(PAPER, rough=0.12, sss=0.3))
objs.append(s)
s = Scene()                                                                      # twisted teal ceramic bar
s.add(round_box(0.5, 1.7, 0.5, 0.1).twist(1.6).rotate(z=-28, x=12), Mat(TEAL, rough=0.25))
objs.append(s)
s = Scene()                                                                      # noisy plum blob, like wet clay
s.add(sphere(0.82).displace(noise3(1.1, 2, seed=SEED + 4), 0.2), Mat(PLUM, rough=0.35, sss=0.4, sss_color="#d07ab0"))
objs.append(s)

for i, s in enumerate(objs):
    sub = Canvas(S, S)
    sub.render(lit(s), aa=2, alpha=True, look="punchy")
    c.place(sub.flatten(), x=i * S + S / 2, y=S / 2, scale=S / sub.W)

save_cells(c, [f"obj-{n}.png" for n in ["torus", "sphere", "vase", "twist", "blob"]], S)