feat: add Unity Standard diffuse brightness toggle - #68
Conversation
- Seed PBR and Hybrid ABI, source ownership, GPU, Meta, and runner self-contract checks for the direct-diffuse brightness toggle. - Verify expected product-missing RED results and keep isolated lighting controls GREEN.
- Add the PBR and Hybrid direct-diffuse normalization toggle while preserving independent Hybrid and indirect-lighting paths. - Synchronize release and cold-consumer ABI contracts and verify focused Daily, Pester, and consumer build checks.
- Document the PBR and Hybrid direct-diffuse brightness toggle, default behavior, affected passes, and Standard compatibility limits. - Verify focused and full Daily coverage, Pester contracts, and direct-lighting boundary observations.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 29 |
| Duplication | 0 |
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.
There was a problem hiding this comment.
Pull request overview
Adds an opt-in toggle to align PBR/Hybrid direct-diffuse normalization with Unity Standard brightness conventions, while preserving existing ownership boundaries (direct vs indirect, Meta, ForwardAdd) and validating the ABI/behavior via expanded Daily + release-runner contracts.
Changes:
- Introduces
_UseUnityStandardDiffuseBrightness(default-off) toPureBase/PBRandPureBase/Hybrid, and threads it into the direct-diffuse term via a dedicated normalization selector. - Updates release validation + consumer ABI/source contracts to include the new visible property and required source fragment.
- Adds/extends Daily tests to verify: diffuse scales by π when enabled, specular/indirect/meta remain invariant, and caller render-state is restored; updates EN/JA documentation accordingly.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/Release/Run-PureBaseReleaseValidation.Tests.ps1 | Updates expected visible property ABI for PBR/Hybrid to include the new toggle. |
| Tests/Release/Run-PureBaseReleaseValidation.ps1 | Extends product contract generation to require the new property/source fragment for PBR/Hybrid. |
| Tests/Release/ConsumerProject/Assets/Editor/PureBaseConsumerReleaseTests.cs | Adds cold-consumer import assertions for the new property’s order/type/default/attributes. |
| Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.cs | Ensures Meta output remains unaffected by the direct-only toggle (enabled vs disabled comparisons). |
| Tests/Daily/Editor/PureBaseToonLightingContractTests.Runtime.cs | Adds partial restoration hook so feature extensions can restore caller-owned state. |
| Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrBrightnessRuntime.cs.meta | Unity metadata for the new runtime extension test file. |
| Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrBrightnessRuntime.cs | Implements runtime capture helpers for direct/indirect/specular observations and restores reflection globals/resources. |
| Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrBrightness.cs.meta | Unity metadata for the new brightness contract test file. |
| Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrBrightness.cs | Adds Daily behavioral tests for π scaling, Standard comparison, invariants, and state restoration. |
| Tests/Daily/Editor/PureBaseRenderingModeRenderingTests.SourceContracts.cs | Adds source-level boundary assertions ensuring the toggle stays direct-only and doesn’t leak into indirect/meta paths. |
| Tests/Daily/Editor/PureBaseRenderingModeContractTests.ProductContracts.cs | Updates product ABI assertions to include the new property and enforce PBR/Hybrid property byte-identity. |
| Shaders/PureBasePBR_properties.hlsl | Adds the _UseUnityStandardDiffuseBrightness Integer/SCToggle property declaration. |
| Shaders/PureBaseHybrid_properties.hlsl | Mirrors the PBR property declaration to keep PBR/Hybrid properties byte-identical. |
| Shaders/Models/pbr.hlsl | Wires the toggle into direct-light evaluation by selecting a diffuse normalization coefficient. |
| Shaders/Common/pbr_brdf.hlsl | Adds PureBasePbrSelectDiffuseNormalization and updates the direct evaluator signature to accept normalization explicitly. |
| Docs/technical-information.md | Documents the new property ABI and its direct-only semantics (English). |
| Docs/technical-information.ja.md | Documents the new property ABI and its direct-only semantics (Japanese). |
| Docs/pure-base-shader-contract.md | Updates the public shader contract to include the new property and clarify semantics. |
Files not reviewed (2)
- Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrBrightness.cs.meta: Generated file
- Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrBrightnessRuntime.cs.meta: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25c3c507c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Replace the optional PBR brightness partial cleanup method with a delegate-backed restoration hook. - Verify Unity state restoration and restore the local Codacy configuration baseline.
- Split PBR and Hybrid source and Meta assertions into focused documented helpers. - Preserve contract coverage and verify the review-targeted Daily tests.
Summary
_UseUnityStandardDiffuseBrightnessInteger/SCToggle property toPureBase/PBRandPureBase/Hybrid.1 / piwhen disabled and1when enabled only for direct diffuse; preserve Hybrid binary diffuse selection, GGX direct specular, indirect lighting, reflection probes, lightmapping, and Meta output.Validation
8 passed / 0 failedPureBase.Tests.DailyEditMode assembly:91 passed / 0 failed / 1 skipped(interactive Editor policy skip for strict BIRP batch isolation)3 passed / 0 failed0 errors / 0 warningsScope Notes
0.2.0-beta.3Release validation remain deferred to parent Issue PBRとHybridの明るさ・品質・性能を改善する #1.