Skip to content

fix: clamp PBR roughness at 0.089 - #69

Merged
PenguinMaintainer merged 4 commits into
masterfrom
future/pbr-roughness-floor
Aug 17, 2026
Merged

fix: clamp PBR roughness at 0.089#69
PenguinMaintainer merged 4 commits into
masterfrom
future/pbr-roughness-floor

Conversation

@PenguinDOOM

Copy link
Copy Markdown
Collaborator

Summary

  • Raise the PBR and Hybrid public perceptual roughness floor to 0.089 and keep their property metadata byte-identical.
  • Route direct BRDF construction, Unity Standard GI/reflection Smoothness, and Meta/lightmapping through one shared runtime clamp.
  • Add ABI, source-ownership, direct/reflection GPU, Meta, real-bake, cold-consumer, and release-runner contract coverage.
  • Document the FP16 rationale, Unity parameterization distinction, and existing-material behavior in the canonical, English, and Japanese documentation.

Validation

  • Focused Daily contracts: passed, including direct/reflection/Meta and existing Issue PBRにUnity Standard互換の明るさ補正を追加する #12 brightness controls.
  • Isolated Daily regression: 96 passed / 0 failed / 0 skipped, including the canonical baseline comparison.
  • Disposable Progressive CPU bake: 1 passed / 0 failed.
  • Release-runner Pester self-contract: 3 passed / 0 failed.
  • Cold-consumer project build: 0 errors.
  • Manual Unity 2022.3.22f1 Built-in/D3D11/Linear direct and reflection-probe observation: stored 0 and 0.089 were stable and visually equivalent; 0.25 remained distinct.

Notes

- Add Daily, bake, and release self-contract coverage for the PBR and Hybrid 0.089 roughness floor.
- Verify old-floor behavior produces the intended RED signals while existing brightness controls remain GREEN.
- Route PBR and Hybrid direct, GI, reflection, and Meta paths through one perceptual roughness floor.
- Verify focused Unity contracts, a disposable one-bake integration test, Pester, and consumer compilation.
- Document the shared PBR and Hybrid 0.089 perceptual roughness contract and existing-material behavior.
- Verify Daily, baseline, bake, Pester, and transient D3D11/Linear direct and reflection stability.
@PenguinDOOM
PenguinDOOM requested review from a team and a lite review from Copilot August 16, 2026 21:04
@PenguinMaintainer PenguinMaintainer self-assigned this Aug 16, 2026
@PenguinMaintainer PenguinMaintainer added enhancement New feature or request fix labels Aug 16, 2026
@PenguinMaintainer PenguinMaintainer added this to the 0.2.0 milestone Aug 16, 2026
@PenguinMaintainer PenguinMaintainer removed the enhancement New feature or request label Aug 16, 2026

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

Adjusts the PBR-family perceptual roughness minimum to 0.089 and ensures that direct BRDF construction, Unity Standard GI/reflection smoothness, and Meta/lightmapping all share a single runtime clamp path, with expanded release/daily/regeneration contract coverage and updated documentation.

Changes:

  • Raise PBR/Hybrid public _Roughness metadata floor to 0.089 (byte-identical between both shaders).
  • Route PBR roughness usage through a shared runtime clamp helper used by BRDF creation and Unity Standard GI setup.
  • Add/extend release-runner, consumer, GPU (direct/reflection), Meta, and real lightmap bake tests; update English/Japanese docs and shader contract docs.

Reviewed changes

Copilot reviewed 18 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/Release/Run-PureBaseReleaseValidation.Tests.ps1 Adds required source-fragment assertions.
Tests/Release/Run-PureBaseReleaseValidation.ps1 Updates product contract required fragments.
Tests/Release/ConsumerProject/Assets/Editor/PureBaseConsumerReleaseTests.cs Verifies imported roughness metadata.
Tests/Regeneration/Editor/PureBaseRoughnessLightmapBakeTests.cs Adds disposable real-bake roughness-floor test.
Tests/Regeneration/Editor/PureBaseRoughnessLightmapBakeTests.cs.meta Unity meta for new bake test.
Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.cs Makes validation regression tests class partial.
Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.PbrRoughness.cs Adds Meta roughness-floor capture contracts.
Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.PbrRoughness.cs.meta Unity meta for new partial test file.
Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughnessRuntime.cs Adds runtime capture helpers for roughness tests.
Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughnessRuntime.cs.meta Unity meta for new runtime partial file.
Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughness.cs Adds GPU direct/reflection roughness-floor contracts.
Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughness.cs.meta Unity meta for new GPU contract file.
Tests/Daily/Editor/PureBaseRenderingModeRenderingTests.SourceContracts.cs Adds source-level ownership checks for clamp usage.
Tests/Daily/Editor/PureBaseRenderingModeRenderingTests.OpenLitSourceContracts.cs Wires roughness-floor ownership assertion into suite.
Tests/Daily/Editor/PureBaseRenderingModeContractTests.ProductContracts.cs Adds ABI checks for roughness property and mirroring.
Shaders/PureBasePBR_properties.hlsl Raises _Roughness SCRange floor to 0.089.
Shaders/PureBaseHybrid_properties.hlsl Keeps property declaration byte-identical to PBR.
Shaders/Models/pbr.hlsl Uses shared clamp for Standard GI smoothness.
Shaders/Common/pbr_brdf.hlsl Introduces shared clamp helper/constant for BRDF.
Docs/technical-information.md Documents new floor rationale and behavior.
Docs/technical-information.ja.md Japanese doc parity for new floor rationale.
Docs/pure-base-shader-contract.md Updates public contract and compatibility notes.
Files not reviewed (4)
  • Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughness.cs.meta: Generated file
  • Tests/Daily/Editor/PureBaseToonLightingContractTests.PbrRoughnessRuntime.cs.meta: Generated file
  • Tests/Daily/Editor/PureBaseValidationSceneRegressionTests.PbrRoughness.cs.meta: Generated file
  • Tests/Regeneration/Editor/PureBaseRoughnessLightmapBakeTests.cs.meta: Generated file

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

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 4 minor

Results:
4 new issues

Category Results
CodeStyle 4 minor

View in Codacy

🟢 Metrics 70 complexity · 0 duplication

Metric Results
Complexity 70
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.

@PenguinMaintainer PenguinMaintainer linked an issue Aug 16, 2026 that may be closed by this pull request
7 tasks
- Assert the named PBR perceptual-roughness runtime constant and its exact 0.0890 value.

- Verify the focused ownership contract passes without weakening adjacent source checks.
@PenguinMaintainer
PenguinMaintainer enabled auto-merge (squash) August 16, 2026 21:29
@PenguinMaintainer
PenguinMaintainer merged commit 96e4097 into master Aug 17, 2026
10 checks passed
@PenguinMaintainer
PenguinMaintainer deleted the future/pbr-roughness-floor branch August 17, 2026 00:33
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の粗さ下限を見直す

3 participants