Skip to content

Preserve instance materials in deferred geometry - #56

Merged
Lemiort merged 1 commit into
masterfrom
bugfix/23-deferred-instance-materials
Oct 25, 2026
Merged

Lemiort merged 1 commit into
masterfrom
bugfix/23-deferred-instance-materials

Conversation

@Lemiort

@Lemiort Lemiort commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Closes #23.

Problem

The deferred geometry pass replaced every command's surface material with one shared pass material. Objects therefore lost their diffuse, normal, and specular textures, and batching grouped instances according to the override instead of their actual material state.

Summary

  • separate pass shader selection from surface material texture binding
  • retain each render command's material when sorting and batching instances
  • bind that material's diffuse, normal, specular, shadow, and custom textures against the deferred pass shader
  • remove the redundant shared deferred geometry material
  • add an OpenGL regression test with two materials and two instanced batches that verifies distinct diffuse/normal/specular values

Verification

  • cmake --build build/build/Release --target NEE opengl_render_tests
  • ctest --test-dir build/build/Release -R PassShaderPreservesPerInstanceSurfaceMaterials --output-on-failure
  • ctest --test-dir build/build/Release -R OpenGLRender --output-on-failure (8/8 passed)
  • ctest --test-dir build/build/Release --output-on-failure --no-tests=error (39/39 passed)

@Lemiort
Lemiort merged commit 929d19d into master Oct 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] Preserve instance materials in the deferred geometry pass

1 participant