-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add OpenPBR's base_diffuse_roughness material parameter #16183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OpenPBR's base_diffuse_roughness material parameter #16183
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
#endif | ||
, 0. | ||
#ifdef BASE_DIFFUSE_ROUGHNESS | ||
, 0. | ||
, vec2(0., 0.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should be done here?
, in float baseDiffuseRoughness | ||
#ifdef BASE_DIFFUSE_ROUGHNESS | ||
, in float baseDiffuseRoughnessTexture | ||
, in vec2 vBaseDiffuseRoughnessInfos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've mimicked what I've seen done in other blocks, but it's not clear to me how those vXYZInfos
are supposed to be used.
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/16183/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16183/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/16183/merge#BCU1XR#0 |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
Moving to draft until we discuss further about it tomorrow :-) |
@@ -2319,6 +2359,11 @@ export abstract class PBRBaseMaterial extends PushMaterial { | |||
} | |||
|
|||
ubo.updateFloat("baseWeight", this._baseWeight); | |||
if (this._baseDiffuseRoughness !== null && this._baseDiffuseRoughness !== undefined) { | |||
ubo.updateFloat("baseDiffuseRoughness", this._baseDiffuseRoughness); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ubo.updateFloat("baseDiffuseRoughness", this._baseDiffuseRoughness ?? this._roughness);
This PR implements the
base_diffuse_roughness
parameter from the OpenPBR specification.As a first step, the PR plugs the new diffuse roughness parameter directly into the Disney diffuse model currently implemented.
A future task will be to implement the Energy Conserving Oren-Nayar model used by OpenPBR.
Test scene:
https://playground.babylonjs.com/?snapshot=refs/pull/16183/merge#MXACV7
A question for maintainers: this changes the behaviour of Babylon.js, as a different roughness is now used for the diffuse lobe. How do we want to handle the case where no diffuse roughness is passed? I assume we ma want to detect that case and assign the specular roughness to it?