-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
TSL: Add function for BPCEM. #29773
TSL: Add function for BPCEM. #29773
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Wow! It's so easy to use now. |
/fyi @spite @sneha-belkhale |
@@ -354,6 +354,7 @@ | |||
"webgpu_materials_arrays", | |||
"webgpu_materials_basic", | |||
"webgpu_materials_displacementmap", | |||
"webgpu_materials_envmaps_bpcem", |
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.
How about a different name, for clarity?
webgpu_materials_envmaps_box_projected
Similar to
webgl_materials_envmaps_ground_projected
(The latter is currently missing an underscore.)
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.
webgl_materials_envmaps_ground_projected
I think this should be webgl_skybox_ground_projected
. This example is not related to the envMap
material property.
Regarding the new example, I don't feel strong about the name. BPCEM is a similar term like PMREM which is why I like and picked it.
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.
Whatever you prefer is OK with me... I thought the acronym may be unfamiliar.
Related issue: #15897
Description
This PR introduces a helper function for using box projected cube environment mapping (BPCEM) for cube textures and PMREMs. This is a nice feature when using environment maps in indoor scenes.
See https://devlog-martinsh.blogspot.com/2011/09/box-projected-cube-environment-mapping.html.
We had this feature in the repository in earlier days as an example but eventually removed it since the shader patching approach was error-prone and broke the demo more than once. Now with TSL we can implement this feature in a much more elegant fashion. There is now the TSL function
getParallaxCorrectNormal()
which can be used to compute custom uvs when usingcubeTexture()
orpmremTexture()
.