Skip to content

@modoki/engine / rendering / applyNprFragmentOutput

Function: applyNprFragmentOutput()

applyNprFragmentOutput(mat, colorRGBA, preserve?): void

Set a custom NPR shader's fragmentNode AND disable the material's fog flag in one call — the safe way to wire a shader into the NPR MRT pass. See the fog hazard note on nprFragmentOutput above: without fog = false, three's setupFog collapses the 3-target outputStruct to a single vec4 and the draw gets discarded by WebGPU whenever the scene has fog enabled. Prefer this over calling nprFragmentOutput + assigning fragmentNode by hand.

Use from a shader file: applyNprFragmentOutput(mat, vec4(myColorRgb, 1.0)); applyNprFragmentOutput(mat, vec4(rgb, 1.0), rimMask); // per-pixel preserve

Parameters

mat

fog

boolean

fragmentNode

unknown

colorRGBA

unknown

preserve?

unknown

Returns

void

Built with Modoki.