What's the difference between `UniformsGroup` and `UniformsGroup`?

There are two of them: src/core/UniformsGroup.js and src/renderers/common/UniformsGroup.js.

The one that seems internal is ironically documented, but the one exported from the lib is not documented (with JSDoc comments, neither of them are documented on the website). Maybe I could read the whole source to find out how each are used, but if someone already knows that’d be helpful.

Currently, there are two UniformsGroup files because the Three.js team is experimenting with moving uniform handling to a new architecture (especially for WebGPU).

  • src/core/UniformsGroup.js: This is the more “public” or higher-level API. It’s exported by the library, but not yet fully documented. It’s intended to group uniforms so they can be updated or bound more efficiently.
  • src/renderers/common/UniformsGroup.js: This is an internal implementation detail, often related to the renderer’s lower-level processes (like WebGPU). It has JSDoc comments in the source, but it’s not exposed as part of Three.js’s public API.
    Over time, the Three.js maintainers may unify or refactor these. If you want to see how each is used, read both the source files and the WebGPU renderer code. Until official documentation is released, reviewing the commit history on GitHub can also provide context about their roles and differences.
1 Like