Per-draw projection-variant selection for materials whose graph is
specialized on the camera's projection KIND (orthographic vs perspective).
The kind is taken from the projection matrix of the camera being drawn with
(P[3][3] — the same test as GLSL luxarIsOrthoProjection() and TSL
isOrthoProjectionTSL()), in the mesh's onBeforeRender, which three's
WebGPU renderer runs for every draw BEFORE it looks up the draw's render
object. Nothing is pushed from the CPU, so a draw through a different
projection than the main camera's (the scene environment capture's cube
faces) selects its own variant, and the next main-view draw selects the
other one back.
Only the TSL screen-space line quad (visual + pick) is specialized this way:
it is the one graph whose single runtime-ortho form measured slower (+4.6% of
the GPU pass on the 10M-segment ortho quad under WebGPU). Every other
material reads the ortho test at runtime and has no selectProjectionVariant,
so the hook is a no-op for it.
Per-draw projection-variant selection for materials whose graph is specialized on the camera's projection KIND (orthographic vs perspective).
The kind is taken from the projection matrix of the camera being drawn with (P[3][3] — the same test as GLSL
luxarIsOrthoProjection()and TSLisOrthoProjectionTSL()), in the mesh'sonBeforeRender, which three's WebGPU renderer runs for every draw BEFORE it looks up the draw's render object. Nothing is pushed from the CPU, so a draw through a different projection than the main camera's (the scene environment capture's cube faces) selects its own variant, and the next main-view draw selects the other one back.Only the TSL screen-space line quad (visual + pick) is specialized this way: it is the one graph whose single runtime-ortho form measured slower (+4.6% of the GPU pass on the 10M-segment ortho quad under WebGPU). Every other material reads the ortho test at runtime and has no
selectProjectionVariant, so the hook is a no-op for it.