Files
solidcraft/examples/studio/author_coffee_framing.py
T
c6cbde3706 Render: studio lighting, clear coat and glass on GPU (#2191)
Integrate the original studio renderer after the GPU executor and async UI foundations, under #5493. Fresh render-target quick run 40011408339 passes. Preserve attribution, bounded resource admission and documented glass/denoising limits. Historical native benchmarks retain their source pins. Full renderer-to-main CI and jyviko sign-off remain separate.

Co-Authored-By: Christian Svensson <blue@cmd.nu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
2026-10-23 21:33:49 +02:00

72 lines
2.5 KiB
Python

"""Original framing variant; derives only new files from the reviewed baseline.
Keep the baseline 32 bodies and names: append rigid translations, never copies.
The camera is lower and closer; optical settings and corrected lights are copied.
Run from any working directory with Python's standard library.
"""
import copy
import json
import math
from pathlib import Path
HERE = Path(__file__).parent
SHIFTS = {'Open brewing head': [0, 0, 28],
'Brewing collar': [0, 0, 28],
'Shower screen': [0, 0, 28],
'Brewing head roof': [0, 0, 40],
'Bent chrome lever': [0, 0, 40],
'Left lever ball': [0, 0, 40],
'Right lever ball': [0, 0, 40],
'Smoky D tank': [100, 8, 0],
'Separate tank lid': [100, 8, 22],
'Tank lid grip': [100, 8, 22],
'Clear ribbed bin': [-70, -15, 0],
'Louvred service panel': [-110, 15, 0],
'Drip tray': [0, -34, 0],
'Perforated stainless grate': [0, -34, 0],
'Rounded tray cap': [38, -34, 0],
'Black S power cable': [50, 8, 0],
'Two pin plug': [50, 8, 0],
'Plug pin 206': [50, 8, 0],
'Plug pin 218': [50, 8, 0],
'Zinc screw 1': [-28, 0, 0],
'Zinc screw 2': [-28, 0, 0],
'Zinc screw 3': [-28, 0, 0],
'Zinc screw 4': [-28, 0, 0],
'Zinc screw 5': [28, 0, 0],
'Zinc screw 6': [28, 0, 0],
'Zinc screw 7': [28, 0, 0],
'Zinc screw 8': [28, 0, 0]}
CAMERA = dict(target=[-25, -10, 170], yaw=math.radians(30), pitch=math.radians(18),
roll=0, distance=950, fov=math.radians(34))
def read(name):
return json.loads((HERE / name).read_text(encoding="utf-8"))
def write(name, value):
(HERE / name).write_text(json.dumps(value, indent=2) + "\n", encoding="utf-8", newline="\n")
def main():
names = list(read("materials.json")["coffee-exploded"])
assert len(names) == 32 and set(SHIFTS).issubset(names)
for source, destination in [("coffee-exploded.json", "coffee-framing.json"),
("coffee-exploded-sweep.json", "coffee-framing-sweep.json")]:
recipe = copy.deepcopy(read(source))
for name, translation in SHIFTS.items():
recipe["commands"].append(dict(command="solid.move", params=dict(
bodies=[name], translate=translation, copy=False,
name="Framing: " + name)))
write(destination, recipe)
render = copy.deepcopy(read("coffee-exploded-render.json"))
render["settings"]["camera"] = CAMERA
# Preserve the physical closed glass, all seven coats and the corrected fill.
# No smoothing or denoising is introduced by the framing variant.
write("coffee-framing-render.json", render)
if __name__ == "__main__":
main()