viewer.widget.SDFViewer
viewer.widget.SDFViewer(
fn,
height=400,
light_dir=(1.0, 2.0, 3.0),
bg_color=(0.05, 0.05, 0.1),
**kwargs,
)
Interactive WebGPU SDF viewer for Jupyter notebooks.
Compiles the SDF to WGSL via jax.export and renders it live in the browser using WebGPU. Supports orbit camera (left-drag), zoom (scroll), pan (right-drag), and reset (double-click).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| fn | Callable | JAX-traceable SDF callable (p: f32[3]) -> f32[]. |
required |
| height | int | Canvas height in CSS pixels. The width fills its container. | 400 |
| light_dir | Sequence[float] | World-space light direction, default [1, 2, 3]. |
(1.0, 2.0, 3.0) |
| bg_color | Sequence[float] | Background RGB in [0, 1], default [0.05, 0.05, 0.1]. |
(0.05, 0.05, 0.1) |
Methods
| Name | Description |
|---|---|
| update_scene | Recompile and hot-reload the scene without recreating the widget. |
update_scene
viewer.widget.SDFViewer.update_scene(fn)
Recompile and hot-reload the scene without recreating the widget.