render.raymarch.render.render_raymarched

render.raymarch.render.render_raymarched(
    sdf,
    camera_pos=jnp.array([5.0, 5.0, 5.0]),
    look_at=jnp.array([0.0, 0.0, 0.0]),
    light_dirs=jnp.array([0.5, 1.0, 0.3]),
    light_colors=None,
    resolution=(200, 200),
    fov=0.6,
    max_steps=48,
    max_dist=20.0,
    shadow_steps=32,
    shadow_hardness=8.0,
    gamma=2.2,
    ambient=0.0,
    aa_samples=1,
    background_color=jnp.array([0.0, 0.0, 0.0]),
    refract_steps=0,
    fd_normals=False,
    normal_eps=0.0001,
    reflect_steps=0,
    env_map=None,
    trace_mode='sphere',
    bisect_steps=8,
    ax=None,
    title=None,
)

Render an SDF via sphere tracing and display with matplotlib.

Wraps :func:raymarch and shows the result on a plt.Axes.

Parameters

Name Type Description Default
sdf Callable[[Array], Array] Signed distance function. required
camera_pos Array Camera position in world space. jnp.array([5.0, 5.0, 5.0])
look_at Array Point the camera looks toward. jnp.array([0.0, 0.0, 0.0])
light_dirs Array Light direction(s), shape (3,) or (N, 3). jnp.array([0.5, 1.0, 0.3])
light_colors Array | None Light color(s), shape (3,) or (N, 3). Defaults to white for every light. None
resolution tuple[int, int] Output image size as (height, width). (200, 200)
fov float Half-width field-of-view parameter. 0.6
max_steps int Sphere tracing iterations per ray. 48
max_dist float Miss threshold distance. 20.0
shadow_steps int Soft shadow ray iterations. 32
shadow_hardness float Shadow edge sharpness. 8.0
gamma float Gamma correction exponent. 2.2
ambient float Constant ambient term (0 = fully black shadows). 0.0
aa_samples int Super-sampling anti-aliasing factor. 1
background_color Array RGB color for rays that miss all geometry. jnp.array([0.0, 0.0, 0.0])
refract_steps int Interior march steps for glass refraction (0 = disabled). 0
fd_normals bool Use finite-difference normals (avoids 2nd-order AD overhead). False
normal_eps float Step size for finite-difference normal estimation. 0.0001
reflect_steps int Mirror reflection march steps (0 = disabled). 0
env_map Array | None Equirectangular HDR environment map (H, W, 3) used for miss-ray and reflection-miss coloring. None
ax plt.Axes | None Existing matplotlib axes; creates new figure if None. None
title str | None Axes title. None

Returns

Name Type Description
plt.Axes The matplotlib axes with the rendered image.