Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule renderer.module·originates fromworld 07158574-5…

rayTracing

Ray tracing: `renderer.setRaytrace` and the readings of the scene acceleration structure a ray-tracing render feature traces against, transmission shadows, and the main camera's view.

by◐lumi·posted 5d ago
What it does

renderer.rayTracing

Ray tracing: renderer.setRaytrace and the readings of the scene acceleration structure a ray-tracing render feature traces against, transmission shadows, and the main camera's view.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

module renderer.rayTracing global renderer Ray tracing: whether the engine builds the scene acceleration structure, and what it reports.

rtSurface( ) → any

══ renderer ray tracing ══════════════════════════════════════════════ Enable + introspect GPU ray tracing. While enabled the engine builds the scene acceleration structure each frame; a ray-tracing render feature (see renderer.feature) traces against it. The same features run on both backends — hardware ray query and the software/compute path — through one trace surface. This module is the sole caller of the internal `__rendering` FFI (resolved at call time: it is registered on demand and may not exist at module load).

setRaytrace(enabled: boolean) → void

Enable or disable GPU ray tracing. While enabled the engine builds the scene acceleration structure each frame so ray-tracing render features can trace against it; disabling stops the build (so it costs nothing until a ray-traced effect is active). Required before any ray-traced shadows / AO / reflections render.

argtypedescription
enabledboolean`boolean`

examples

renderer.setRaytrace(true); renderer.feature.create("rt_shadows")

getRaytrace( ) → boolean

Whether ray tracing is currently enabled.

raytraceCapability( ) → string

The active ray-tracing backend: `"hardware"` (GPU ray query) or `"compute"` (software traversal — the path on devices without hardware ray query, e.g. the web). The same ray-tracing features work on both.

examples

if renderer.raytraceCapability() == "hardware" then ... end

raytraceStats( ) →

What the ray-tracing acceleration structure holds, and what this session's frames have spent building it. A ray walks a structure built over the scene's geometry, and keeping it current is work a frame pays before it traces anything. On the `"compute"` backend the geometry the first build meets is filed under a static partition the frames after it leave alone, and geometry that moves joins a dynamic one until re-emitting it while it stands still has cost a rebuild of the scene: `staticTriangles` + `dynamicTriangles` = `triangles`, `nodes` is the hierarchy over them, `fullRebuilds` / `partialRebuilds` / `reusedFrames` count what the session's frames did, and `trianglesRebuilt` is what those rebuilds re-emitted, summed. `triangleLimit` is the most triangles that structure holds on this device (its triangle buffer and the hierarchy over them are each one storage binding); a scene past it is traced in its own order up to the limit, and `renderablesLeftOut` / `trianglesLeftOut` count the renderables left out and the triangles they ask for, which a ray passes through. On the `"hardware"` backend `blas` is the bottom-level structures cached: one for each mesh an instance places (or placed within the last few frames), per whether its material keeps holes, and one for each skinned or morph-deformed instance. A mesh uploaded again under its name is built again and a destroyed mesh gives its structure up. `blasBuilt` is how many the last frame built, and `tlasInstances` what the top-level structure names; `tlasBuilds` is how many frames built it, and a frame whose instances all stand where the last build put them builds nothing. `tlasInstancesWritten` is how many instances those frames wrote: every instance when the structure is laid out again, the moved ones on every other frame. `blasRefits` is how many times a structure was updated over its moved vertices: a skinned or morph-deformed one, or that of a mesh a compute pass writes, refit on the frame after the write. `blasBuilds` is how many structures were built afresh. On both backends `hitRows` is the rows the hit-surface table holds (the shading attributes a hit resolves to: one row per triangle of each traced mesh, and a posed copy for each instance a skeleton or a morph blend deforms), `hitRowLimit` the most rows one storage binding of the device holds, and `hitRowsLeftOut` the rows the traced geometry asks for past that limit, which the table leaves out: a ray that meets a mesh left out reads a flat surface. The counters are cumulative — sample, run the scene, sample again; the hit-table figures are what the table holds now.

examples

local before = renderer.raytraceStats().trianglesRebuilt

setTransmissionShadows(enabled: boolean) → void

Let translucent casters tint the sunlight they block instead of blocking it outright. A shadow map holds one depth per texel and is compared as a yes-or-no test, so stained glass, water and thin fabric all project the same black silhouette a wall does. With this on, a caster whose material declares `transmission` draws into a light-space transmittance map instead, and the colour it lets through multiplies into the directional light reaching whatever stands behind it. Stacked casters compose. A surface whose material blends writes no depth shadow at all and throws its shadow through this map alone: a transparent or premultiplied blend lets `1 - alpha` of the light through untouched and its `transmission` of the rest tinted by its base colour, so red stained glass throws red light; a multiply blend lets its base colour through; an additive one blocks nothing. Opaque casters are unaffected, and a scene with no translucent caster allocates nothing and records no pass.

argtypedescription
enabledboolean`boolean`

examples

renderer.setTransmissionShadows(true)  -- stained glass tints the floor

transmissionShadows( ) → boolean

Whether translucent casters tint the directional light they block.

mainCameraView( ) →

The main camera's inverse view-projection (column-major, 16 numbers) followed by its world position (3 numbers) — `{m0..m15, px,py,pz}` — for reconstructing world positions from the depth buffer in a ray-tracing pass. Nil before the first render.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.