-
-
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
Nodes: Add CubeMapNode
.
#29073
Nodes: Add CubeMapNode
.
#29073
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
||
const _cache = new WeakMap(); | ||
|
||
class CubeMapNode extends TempNode { |
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.
@sunag This module should be for internal use only so it is not exported in Nodes.js
. Still, I'm a bit unsure about the name CubeMapNode
since its quite similar to CubeTextureNode
.
CubeMapNode
should be in some sense the non-PBR version of PMREMNode
. Meaning it encapsulate different inputs to provide a single environment map format for the material.
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.
I'm not sure if we need this, wouldn't just manipulating the UV be enough since we don't need to pre-filter for non-PBR?
import { texture, equirectUV, reflectVector, refractVector } from 'three/ts';
const coord = reflectVector; // refractVector
const env = texture( textureEquirec, equirectUV( coord ) );
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.
The problem with using equirectangular uvs are the artifacts that result at the poles which do not occur with the cube map format. They were previously reported as bugs which was one reason for not directly supporting equirectangular textures in the shader.
I'm afraid users will complain when the artifacts appear again when migrating from WebGLRenderer
.
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.
Interesting, if so let's merge the PR, it seems good to me.
Related issue: -
Description
WebGPURenderer
must be able to automatically convert equirectangular textures into the cube map format. This is now done by a new utility classCubeMapNode
. Similar toPMREMNode
, this class is intended to setup the environment map for materials and later the background (see #28827).