Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

rt_hit_surface

Draws the scene from the rays: one primary ray per pixel out of the drawn camera, resolved with zeroHitSurface and shaded with zeroMaterial.

Where rt_shadows and rt_ao only ask whether something is there, this asks what it is — the base colour, the interpolated normal and the uv of the surface the ray landed on.

renderer.setRaytrace(true)
renderer.feature.create("@builtin::renderFeatures.rt_hit_surface")

The rasterizer and the rays start from the same vertex attributes and arrive by completely different routes, so an image that matches the rasterized view is an end-to-end statement that hits resolve correctly for every mesh and material on screen at once. A surface whose normal did not resolve shades uniformly; one whose material did not resolve takes the default white.

Textures are not sampled at a hit, so a textured surface reads as its flat base colour here while the rasterized view shows the texture.

The camera rides @frame.camera and the target is screen-sized, so the answer follows whichever camera is being drawn, at its own resolution. Runs on either ray-tracing backend.