-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Diffuse Roughness support #16253
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
base: master
Are you sure you want to change the base?
Diffuse Roughness support #16253
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
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/16253/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16253/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/16253/merge#BCU1XR#0 |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
1 similar comment
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
3580a82
to
55f34a0
Compare
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
1 similar comment
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
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.
This is only a partial review with a couple of comments.
packages/tools/tests/test/visualization/ReferenceImages/openpbr-base-diffuse-roughness.png
Outdated
Show resolved
Hide resolved
...ols/tests/test/visualization/ReferenceImages/openpbr-base-diffuse-roughness-realtime-ibl.png
Outdated
Show resolved
Hide resolved
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.
Continued review.
packages/dev/core/src/Shaders/ShadersInclude/hdrFilteringFunctions.fx
Outdated
Show resolved
Hide resolved
packages/dev/core/src/Shaders/ShadersInclude/pbrDirectLightingFunctions.fx
Outdated
Show resolved
Hide resolved
packages/dev/core/src/Shaders/ShadersInclude/pbrDirectLightingFunctions.fx
Outdated
Show resolved
Hide resolved
packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.fx
Outdated
Show resolved
Hide resolved
packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.fx
Outdated
Show resolved
Hide resolved
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
1 similar comment
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
203a6cf
to
5ee9410
Compare
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
6b0f7a4
to
2f1cf0e
Compare
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
Co-authored-by: Popov72 <[email protected]>
1acd8bf
to
d4278a2
Compare
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). |
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/16253/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16253/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/16253/merge#BCU1XR#0 |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
I do not think we should change it cc @RaananW |
No need to replace the entire interface, you will need to add Fetch from master and run |
This reverts commit ad419a4.
Head branch was pushed to by a user without write access
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
This PR replaces #16183
This PR implements the base_diffuse_roughness parameter from the OpenPBR specification.
The diffuse roughness is implemented for analytic lights, realtime-filtered IBL, prefiltered IBL and spherical harmonics.
I've added a flag to a material to choose between Lambert, Burley and the new Energy Conserving Oren-Nayar (EON) model used by OpenPBR. The default is OpenPBR's EON model.
The previous behaviour was to use Burley diffuse for analytical lights and Lambert for IBL. Also, previously, specular roughness was applied to diffuse roughness for analytical lights while IBL didn't use it at all (because it was simply Lambertian). So, the new default slightly changes existing projects that used analytical lights but I question how noticeable that will be.
Analytical Light:

https://playground.babylonjs.com/?snapshot=refs/pull/16253/merge#MXACV7#3
Realtime IBL:

https://playground.babylonjs.com/?snapshot=refs/pull/16253/merge#MXACV7#5
The diffuse roughness models are heavily dependent on the light direction and view direction and are therefore difficult to handle with a prefiltered IBL. I came up with two methods for approximating roughness with prefiltered IBL's. The first, if we prefiltered using CDF, we generate a dominant light direction to use in the BRDF calculations. It works reasonably well.
Prefiltered IBL with CDF:

https://playground.babylonjs.com/?snapshot=refs/pull/16253/merge#MXACV7#9
The second approach, if you don't use CDF, is by approximating roughness by bending the surface normal towards the camera to add some of the retro-reflective behaviour that you get with EON. Because of this, you'll notice that Burley and EON are identical and the shadow terminator appears to move as diffuse roughness increases. In practice, however, this example uses an extreme IBL with a bright sunlight. With other IBL's, the effect tends to be more convincing.
Prefiltered IBL without CDF

https://playground.babylonjs.com/?snapshot=refs/pull/16253/merge#MXACV7#10
The default IBL lighting in Sandbox uses spherical harmonics so we need to approximate diffuse roughness with this as well. I'm using the same bent normal technique as with prefiltered IBL without CDF.
Spherical Harmonics IBL

https://playground.babylonjs.com/?snapshot=refs/pull/16253/merge#MXACV7#11