Skip to content

CubeTextureNode: Support CubeRefractionMapping.#28823

Merged
Mugen87 merged 4 commits intomrdoob:devfrom
Mugen87:dev1
Jul 6, 2024
Merged

CubeTextureNode: Support CubeRefractionMapping.#28823
Mugen87 merged 4 commits intomrdoob:devfrom
Mugen87:dev1

Conversation

@Mugen87
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown

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
Copy Markdown
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants