refactor(material): add surface contract and G-buffer shader variant #943

Merged
SakulFlee merged 1 commit from feat/renderer-phase-4 into main 2026-10-26 18:33:47 +00:00
Collaborator

Summary

Phase 4a: give PBR materials a shared Surface contract and a G-buffer shader variant. No renderer behavior changes yet.

  • New surface() node returns albedo, normal, roughness, metallic, emissive, occlusion and alpha without applying lighting.
  • Forward PBR entrypoint and the new G-buffer entrypoint both consume surface(), so the deferred path shares the exact material math.
  • Shared PBR bindings and the vertex entrypoint moved into library nodes (pbr_bindings, pbr_vertex) so forward and G-buffer variants assemble from one library.
  • New G-buffer entrypoint writes three targets:
    • @location(0) albedo + AO
    • @location(1) normal + roughness
    • @location(2) metallic + emissive
  • Naga validation covers the assembled forward and G-buffer PBR shaders.

The G-buffer pass, deferred lighting shader and clustered light culling are the next PRs.

Verification

  • cargo fmt --all -- --check
  • cargo clippy -p orbital_shader_pbr -p orbital_resources -p orbital_renderer -p orbital_app -- -D warnings
  • cargo test -p orbital_shader_pbr -p orbital_resources -p orbital_renderer -p orbital_app --no-fail-fast
  • 21 naga WGSL tests pass, including both assembled PBR variants.
  • GUI examples were not launched in this environment (no display/GPU).

Refs #781.

## Summary Phase 4a: give PBR materials a shared `Surface` contract and a G-buffer shader variant. No renderer behavior changes yet. - New `surface()` node returns albedo, normal, roughness, metallic, emissive, occlusion and alpha without applying lighting. - Forward PBR entrypoint and the new G-buffer entrypoint both consume `surface()`, so the deferred path shares the exact material math. - Shared PBR bindings and the vertex entrypoint moved into library nodes (`pbr_bindings`, `pbr_vertex`) so forward and G-buffer variants assemble from one library. - New G-buffer entrypoint writes three targets: - `@location(0)` albedo + AO - `@location(1)` normal + roughness - `@location(2)` metallic + emissive - Naga validation covers the assembled forward and G-buffer PBR shaders. The G-buffer pass, deferred lighting shader and clustered light culling are the next PRs. ## Verification - `cargo fmt --all -- --check` - `cargo clippy -p orbital_shader_pbr -p orbital_resources -p orbital_renderer -p orbital_app -- -D warnings` - `cargo test -p orbital_shader_pbr -p orbital_resources -p orbital_renderer -p orbital_app --no-fail-fast` - 21 naga WGSL tests pass, including both assembled PBR variants. - GUI examples were not launched in this environment (no display/GPU). Refs #781.
refactor(material): add surface contract and G-buffer shader variant
All checks were successful
Lint / lint (pull_request) Successful in 1m2s
PR / test (pull_request) Successful in 1m52s
0d14879605
Split PBR material data into a reusable Surface (albedo, normal, roughness, metallic, emissive, occlusion, alpha). Forward and G-buffer fragments now consume the same surface function. Move shared PBR bindings and the vertex entrypoint into nodes so both variants assemble from one library.

Add a three-target G-buffer entrypoint (albedo+AO, normal+roughness, metallic+emissive) and validate it with naga. No renderer behavior changes yet; the G-buffer pass and deferred lighting follow.

Smart test results

Result: PASS

Scope: orbital_resources, orbital_shader_pbr

Reason: directly changed crates

Elapsed: 1m 27s

Workflow run

Overall: 24 tests, 24 passed, 0 failed, 0 skipped

Nextest: 24 tests, 24 passed, 0 failed, 0 skipped
Doctests: no tests reported

Crate Nextest Passed Failed Skipped Doctests Time
orbital_resources 21 21 0 0 - 0.16s
orbital_shader_pbr 3 3 0 0 - 0.02s
pie showData
    title Nextest outcomes
    "Passed" : 24
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital_resources", "orbital_shader_pbr"]
    y-axis "Seconds" 0 --> 1
    bar [0.16, 0.02]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** orbital_resources, orbital_shader_pbr **Reason:** directly changed crates **Elapsed:** 1m 27s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/670) **Overall:** 24 tests, 24 passed, 0 failed, 0 skipped **Nextest:** 24 tests, 24 passed, 0 failed, 0 skipped **Doctests:** no tests reported | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital_resources | 21 | 21 | 0 | 0 | - | 0.16s | | orbital_shader_pbr | 3 | 3 | 0 | 0 | - | 0.02s | ```mermaid pie showData title Nextest outcomes "Passed" : 24 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital_resources", "orbital_shader_pbr"] y-axis "Seconds" 0 --> 1 bar [0.16, 0.02] ```
SakulFlee deleted branch feat/renderer-phase-4 2026-10-26 18:33:47 +00:00
Sign in to join this conversation.
No description provided.