sharedUniformGroup
Creates a global uniform group that can be referenced by multiple different materials. It allows data like camera and lighting information to be uploaded to the GPU once and shared, solving the performance issues of redundant data uploads.
Core Advantages
Drastically reduces CPU-to-GPU data transfer and state changes by uploading data once for many materials to share, significantly boosting rendering performance in complex scenes and ensuring global data consistency.
Common Uses
Sharing scene-wide camera matrices
Providing uniform global lighting and environment parameters
Synchronizing animations or effects across multiple materials (e.g., time, wind strength)
How to adjust
The node itself is not adjustable. By modifying the .value property of a uniform node that has been added to this group, the change is automatically and efficiently broadcast to all materials using this shared group, enabling synchronized control of global effects.
Code Examples
1// 1. Create a custom shared Uniform group
2const windUniforms = sharedUniformGroup('WindEffects');
3
4// 2. Define Uniforms and associate them with the shared group via .setGroup()
5const windStrength = uniform(0.5).setGroup(windUniforms);