cubeTexture
Creates a node that samples a cube texture (CubeMap) using a 3D direction vector, essential for environment mapping effects.
Core Advantages
Completely abstracts the low-level GLSL details (uniforms, textureCube calls, LOD control), allowing you to focus on high-level logic like which environment to use and from which direction to sample.
Common Uses
Skyboxes
Dynamic Environment Reflections
Environment Refractions
Image-Based Lighting (IBL)
How to adjust
Adjust the `value` (the `THREE.CubeTexture` itself) to change the entire environment (e.g., from a sunny beach to a city at night). Modify the `uvNode` (the sampling direction vector) to switch between effects like reflection (`ReflectNode`) and refraction (`RefractNode`), or to create blurred reflections by mixing the reflection vector with the surface normal. Use the `biasNode` to efficiently control blurriness by shifting the Mipmap level, creating effects from sharp to very blurry reflections.
Code Examples
1// Sample the environment map using the reflection vector
2const reflectedColor = cubeTexture( envMap, reflectNode );