Hello,
I came back to an old code, and since the update of the packages this one does not work anymore, I tried to isolate the error and it seems to come from the shaderMaterial.
I get the following error:
Uncaught TypeError: Cannot read properties of undefined (reading ‘morphAttributes’)
at Object.getParameters
Here is the code:
const GrassMaterialFar = shaderMaterial(
{
bladeHeight: 0.6,
map: null,
time: 0,
tipColor: new THREE.Color(0.0, 0.6, 0.0).convertSRGBToLinear(),
bottomColor: new THREE.Color(0.0, 0.1, 0.0).convertSRGBToLinear(),
},
vertexFragmentFar,
fragmentShaderFar,
(self) => {
self.side = THREE.DoubleSide;
}
);
extend({ GrassMaterialFar });
And I use it like this:
// HACK to share material across all instances
const [materialFarRefCurrent, materialFarRef] = useState();
useFrame((state) => {
materialFarRefCurrent.uniforms.time.value = state.clock.elapsedTime / 4;
});
return (
<>
<grassMaterialFar ref={materialFarRef} map={texture} toneMapped={false} />
{materialFarRefCurrent &&
POSITION_LIST.map((position, i) => {
...
})}
</>
);