uniformGroup
uniformGroup
Packs multiple uniform variables into a logical group, submitted efficiently to the GPU as a single Uniform Buffer Object (UBO), solving performance bottlenecks and code organization issues.
Core Advantages
Drastically improves rendering performance through batch data updates, while enabling logical grouping and modularity of uniforms, making code clearer, easier to maintain, and reusable.
Common Uses
Managing scene-level global data (e.g., camera, time)
Defining reusable material property packs (e.g., PBR parameters)
Organizing data for complex lighting systems
How to adjust
The node itself is not adjustable. Visual changes are driven by modifying the .value property of the individual uniform nodes within it; the group ensures these updates are efficiently batched to the GPU.
Code Examples
1// 1. Create a uniform group to manage related uniforms
2const myMaterialGroup = uniformGroup( 'materialUniforms' );
3
4// 2. Create uniform nodes and add them to the group
5myMaterialGroup.add( uniform( new THREE.Color() ) );
6myMaterialGroup.add( uniform( 0.5 ) );