Ever tried using <shaderMaterial uniforms={{ time: { value: time } }} /> and ran into immediate issues with desync? No more.
The uniforms objects on ShaderMaterial and its derivatives now have a stable reference. Objects passed into uniforms will instead copy into it. This is the same as behavior for math structures that have copy such as position, rotation, quaternion, etc. and ends up simplifying using the raw JSX where utilities were often introduced before.
Documentation can be found here: https://r3f.docs.pmnd.rs/api/objects#shader-material-uniforms
And an example can be found here: https://github.com/pmndrs/react-three-fiber/blob/master/example/src/demos/ShaderMaterial.tsx
What's Changed
- fix: Fix broken link on "Performance pitfalls" documentation page by @simonKristensen in #3700
- fix: uniforms have stable refs for ShaderMaterial by @krispya in #3715
- docs: fix typos and documentation consistency by @NssGourav in #3709
New Contributors
- @simonKristensen made their first contribution in #3700
- @NssGourav made their first contribution in #3709
Full Changelog: v9.5.0...v9.6.0