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

CubeTextureNode: Support CubeRefractionMapping. #28823

Merged
merged 4 commits into from
Jul 6, 2024
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 6, 2024

Related issue: #28785

Description

CubeTextureNode currently only supports CubeReflectionMapping. This PR adds support for CubeRefractionMapping.

@sunag The code works if you choose CubeRefractionMapping when creating the material. When using CubeReflectionMapping and switching to CubeRefractionMapping via the GUI, the material should update when material.needsUpdate is set to true. This does not work yet so the mapping does not change. Is there some caching mechanism in place that dees not detect the mapping change of the used cube texture? WebGLRenderer checks the mapping value if an environment map is in place during the program cache key computation so it does not miss this use case.

envMapMode: HAS_ENVMAP && envMap.mapping,

Side note: For the further development process it would be good to have an example for each material that covers most material features. Something like the * variations examples that we used to have in context of WebGLRenderer or the material browser in the documentation. For now I have added webgpu_materials_basic next to the existing webgpu_materials_toon and webgpu_materials_matcap.

Copy link

github-actions bot commented Jul 6, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
460.6 kB (111.1 kB) 460.6 kB (111.1 kB) +0 B
@sunag
Copy link
Collaborator

sunag commented Jul 6, 2024

I push a fix RenderObject.getMaterialCacheKey() should take care of that, in case of NodeMaterial the cache key should come from customProgramCacheKey() of material.*Node properties.

@Mugen87 Mugen87 marked this pull request as ready for review July 6, 2024 14:08
@Mugen87 Mugen87 added this to the r167 milestone Jul 6, 2024
@Mugen87 Mugen87 force-pushed the dev1 branch 3 times, most recently from 424d8de to 38d4eb1 Compare July 6, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants