Skip to content

Add MeshInstance.shaderPassMask to control shader pass participation#8852

Merged
mvaligursky merged 1 commit into
mainfrom
mv-mesh-shader-pass-mask
Jun 6, 2026
Merged

Add MeshInstance.shaderPassMask to control shader pass participation#8852
mvaligursky merged 1 commit into
mainfrom
mv-mesh-shader-pass-mask

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Adds a per-mesh-instance bitmask controlling which shader passes a mesh instance is rendered in.

Changes:

  • New MeshInstance.shaderPassMask property (defaults to 0xFFFFFFFF, all passes). Bit N enables the mesh instance in shader pass index N.
  • The forward renderer skips a mesh instance in a pass when its bit is cleared (inlined bit test in the draw-call prepare loop).
  • Cross-linked the docs between MeshInstance#shaderPassMask and CameraComponent#setShaderPass, so the custom pass index returned by setShaderPass can be used directly in the mask.

API Changes:

  • Added MeshInstance.shaderPassMask (number, public).

A primary use case: render a mesh into the depth prepass (feeding effects such as Depth of Field) while excluding it from the forward color pass, so it contributes depth without being visible. Also supports including/excluding meshes from custom camera shader passes.

Adds a per-mesh-instance bitmask controlling which shader passes a mesh
instance is rendered in. Bit N enables the mesh in shader pass index N,
defaulting to 0xFFFFFFFF (all passes). The forward renderer skips a mesh
instance in a pass when its bit is cleared.

Enables, for example, rendering a mesh into the depth prepass (feeding
effects such as Depth of Field) while excluding it from the forward color
pass, so it contributes depth without being visible. Docs are cross-linked
with CameraComponent.setShaderPass for use with custom shader passes.
@mvaligursky mvaligursky self-assigned this Jun 6, 2026
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Jun 6, 2026
@mvaligursky mvaligursky merged commit 1faae5d into main Jun 6, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-mesh-shader-pass-mask branch June 6, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant