Skip to content

feat: add Unity Standard diffuse brightness toggle - #68

Merged
PenguinMaintainer merged 5 commits into
masterfrom
future/unity-standard-diffuse-brightness
Aug 16, 2026
Merged

feat: add Unity Standard diffuse brightness toggle#68
PenguinMaintainer merged 5 commits into
masterfrom
future/unity-standard-diffuse-brightness

Conversation

@PenguinDOOM

Copy link
Copy Markdown
Collaborator

Summary

  • Add the default-off _UseUnityStandardDiffuseBrightness Integer/SCToggle property to PureBase/PBR and PureBase/Hybrid.
  • Select 1 / pi when disabled and 1 when enabled only for direct diffuse; preserve Hybrid binary diffuse selection, GGX direct specular, indirect lighting, reflection probes, lightmapping, and Meta output.
  • Add Daily GPU/source/ABI contracts, release-runner and cold-consumer ABI checks, and canonical English/Japanese documentation.

Validation

  • Focused Unity Daily tests: 8 passed / 0 failed
  • Full PureBase.Tests.Daily EditMode assembly: 91 passed / 0 failed / 1 skipped (interactive Editor policy skip for strict BIRP batch isolation)
  • Release-runner Pester self-contract: 3 passed / 0 failed
  • Cold-consumer test project build: 0 errors / 0 warnings
  • Manual unsaved D3D11/Linear verification confirmed direct nonmetallic diffuse brightening only; specular, direct-free SH/reflection output, and ForwardAdd ownership remain stable.

Scope Notes

  • "Unity Standard-compatible" is limited to effective direct-diffuse normalization and a controlled normal-incidence comparison; it does not claim Disney diffuse angular/roughness or full Standard BRDF equivalence.
  • Package version, release URL, CHANGELOG, VPM metadata, and the actual 0.2.0-beta.3 Release validation remain deferred to parent Issue PBRとHybridの明るさ・品質・性能を改善する #1.

- 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.
@PenguinDOOM
PenguinDOOM requested review from a team and a lite review from Copilot August 16, 2026 15:48
@codacy-production

codacy-production Bot commented Aug 16, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 29 complexity · 0 duplication

Metric Results
Complexity 29
Duplication 0

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

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) to PureBase/PBR and PureBase/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.

Comment thread Tests/Daily/Editor/PureBaseRenderingModeContractTests.ProductContracts.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread Shaders/PureBasePBR_properties.hlsl
Comment thread Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.cs Outdated
- 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.
@PenguinDOOM PenguinDOOM added the enhancement New feature or request label Aug 16, 2026
@PenguinDOOM PenguinDOOM added this to the 0.2.0 milestone Aug 16, 2026
@PenguinDOOM PenguinDOOM linked an issue Aug 16, 2026 that may be closed by this pull request
7 tasks
@PenguinMaintainer
PenguinMaintainer merged commit a675bae into master Aug 16, 2026
10 checks passed
@PenguinMaintainer
PenguinMaintainer deleted the future/unity-standard-diffuse-brightness branch August 16, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PBRにUnity Standard互換の明るさ補正を追加する

3 participants