Skip to content
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

MeshPhysicalMaterial: Add dispersion. #28051

Merged
merged 2 commits into from
Apr 3, 2024
Merged

MeshPhysicalMaterial: Add dispersion. #28051

merged 2 commits into from
Apr 3, 2024

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Apr 2, 2024

Fixed #28001.

Description

This PR adds dispersion support to MeshPhysicalMaterial based on KHR_materials_dispersion.

It enhances GLTFLoader, the editor and adds a new example webgl_loader_gltf_dispersion. I have temporarily updated the build files so it can be tested here:

https://rawcdn.githack.com/Mugen87/three.js/55c6ae017d7953a4040d8fdbe00fbb7f9cd31c49/examples/webgl_loader_gltf_dispersion.html

For comparison this is the same model with the Khronos glTF Sample Viewer: https://github.khronos.org/glTF-Sample-Viewer-Release/?model=https://raw.GithubUserContent.com/KhronosGroup/glTF-Sample-Assets/main/./Models/DispersionTest/glTF-Binary/DispersionTest.glb

The idea is to use the dispersion value to compute three separate IOR values for the red, green, and blue channel. The transmission computation is then evaluated per color channel with the respective IOR. The implementation is based on the glTF sample viewer GLSL.

I'll update the docs when the implementation is approved.

@Mugen87 Mugen87 added this to the r164 milestone Apr 2, 2024
Copy link

github-actions bot commented Apr 2, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
671.1 kB (166.4 kB) 672.8 kB (166.7 kB) +1.71 kB

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
451 kB (109 kB) 452.5 kB (109.3 kB) +1.5 kB
examples/webgl_loader_gltf_dispersion.html Outdated Show resolved Hide resolved
examples/models/gltf/DispersionTest.glb Outdated Show resolved Hide resolved
@Mugen87 Mugen87 merged commit a7a9996 into mrdoob:dev Apr 3, 2024
9 of 11 checks passed
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Apr 3, 2024

@mrdoob The CI always fails with my version of the E2E screenshot for the new example webgl_loader_gltf_dispersion. Do you mind generating the screenshot on your system?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Apr 3, 2024

Never mind! I could fix the issue by generating the screenshot on a different device, see #28062.

@donmccurdy
Copy link
Collaborator

The effect here looks excellent, thank you @Mugen87!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants