Skip to content

fix: use Smith GGX visibility approximation - #70

Merged
PenguinDOOM merged 6 commits into
masterfrom
future/smith-ggx-visibility-approximation
Aug 19, 2026
Merged

fix: use Smith GGX visibility approximation#70
PenguinDOOM merged 6 commits into
masterfrom
future/smith-ggx-visibility-approximation

Conversation

@PenguinDOOM

Copy link
Copy Markdown
Collaborator

Summary

  • replace the shared PBR/Hybrid direct GGX visibility path with the linearized Smith joint GGX approximation using academic roughness p^2
  • keep the GGX distribution's p^4 ownership, add normal/Switch denominator handling, and retain direct-specular arithmetic in float through NdotL
  • add analytical, source-contract, and GPU coverage plus schema v4 direct-light evidence that isolates ForwardBase as one-light minus zero-light and ForwardAdd as two-lights minus one-light
  • document provenance, formula behavior, evidence limits, and final v4 capture metadata in English and Japanese

Validation

  • focused source, analytical, GPU visibility, PBR/Hybrid roughness, and brightness controls: 11 passed
  • v4 legacy and fast GPU evidence captures: 1/1 passed each; 69 matched image pairs with byte-identical inputs
  • manual v4 visual review: approved; fixed-fixture comparison recorded 0 differing pixels/channels and maximum absolute channel delta 0
  • pwsh -NoProfile -File "D:\VRChatProjects\Pure-Base\Packages\jp.penguin.purebase\Tests\Run-PureBaseRegression.ps1" -Mode Daily: 99 passed, 0 failed, 0 skipped
  • canonical BIRP baseline, Shader-Core ProjectSettings, and tracked package tree were unchanged by the final Daily run

Limitations

- Add source, analytical, GPU, and external evidence contracts for the shared Smith GGX visibility change.
- Validate formula and fixture controls while preserving the intended missing-helper RED contract.
- Replace the direct PBR visibility roots with a shared p-squared linearized Smith GGX helper.
- Verify source, analytical, GPU, roughness, and brightness contracts in Unity EditMode.
- Regenerate schema v4 direct-light evidence and document the approved shared Smith GGX visibility behavior.
- Verify the canonical isolated Daily suite passes 99 tests without baseline or protected-state changes.
@PenguinDOOM
PenguinDOOM requested review from a team and a lite review from Copilot August 19, 2026 03:13
@PenguinDOOM PenguinDOOM added this to the 0.2.0 milestone Aug 19, 2026
@PenguinDOOM PenguinDOOM linked an issue Aug 19, 2026 that may be closed by this pull request
6 tasks
@codacy-production

codacy-production Bot commented Aug 19, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 114 complexity · 6 duplication

Metric Results
Complexity 114
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Pure-Base’s shared PBR/Hybrid direct-light GGX visibility term to use a linearized Smith joint GGX approximation (using academic roughness a = p^2), and adds focused source/analytical/GPU-contract evidence plus documentation updates to support the behavior change.

Changes:

  • Replace the direct GGX visibility calculation in PureBasePbrEvaluateDirect with a new shared helper implementing the linearized Smith joint GGX visibility approximation (Switch-aware denominator handling included).
  • Extend Daily EditMode tests with analytical/source-layout contracts and optional external evidence export to validate finiteness, degeneracies, and pass isolation behavior.
  • Update technical documentation and NOTICE with provenance, formula details, and evidence metadata.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughnessRuntime.cs Adds runtime capture support for full-frame visibility observations and evidence artifact writing.
Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughness.cs Adds visibility reference-case tests plus opt-in external evidence export flow and JSON manifest building.
Tests/Daily/Editor/PureBasePbrVisibilityApproximationTests.cs.meta Adds Unity .meta for the new test file.
Tests/Daily/Editor/PureBasePbrVisibilityApproximationTests.cs Adds analytical characterization and source-layout contracts ensuring the intended fast visibility helper is used and shaped correctly.
Shaders/Common/pbr_brdf.hlsl Introduces PureBasePbrEvaluateSmithJointGgxVisibility and updates direct BRDF evaluation to use it with widened float arithmetic.
NOTICE Adds visibility-term provenance and Unity behavior-reference clarification.
Docs/technical-information.md Documents the new direct GGX visibility helper, formula, and evidence scope/limits (English).
Docs/technical-information.ja.md Documents the new direct GGX visibility helper, formula, and evidence scope/limits (Japanese).
Docs/pure-base-shader-contract.md Updates shader contract documentation to reflect the new direct GGX visibility behavior and evidence summary.
Files not reviewed (1)
  • Tests/Daily/Editor/PureBasePbrVisibilityApproximationTests.cs.meta: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughnessRuntime.cs Outdated
- Refactor private visibility test inputs and numerical checks to remove actionable Codacy findings.
- Verify focused Unity tests and WSL Codacy analyzers pass without changing capture semantics.
- Refactor private visibility test inputs and symmetry assertions to remove actionable Codacy findings.
- Verify diagnostics and local Codacy analyzers; confirm the Cloud PR gate after push.
- Format visibility observation labels and diagnostic filenames with invariant culture.
- Verify the fr-FR regression contract and focused Daily visibility tests pass.
@PenguinDOOM
PenguinDOOM enabled auto-merge (squash) August 19, 2026 17:36
@PenguinDOOM
PenguinDOOM merged commit d6728dd into master Aug 19, 2026
10 checks passed
@PenguinMaintainer
PenguinMaintainer deleted the future/smith-ggx-visibility-approximation branch August 19, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PBRのSmith GGX可視性項を高速近似へ置き換える

3 participants