Setting up shadermaterial for use in instanced mesh

Hi @Manas_Gangwani

Can you check if this thread helps? createInstance with ShaderMaterial does not render

I think the main difference is instead of using worldViewProjection, you should use finalWorld from #include<instancesVertex>

So
gl_Position = worldViewProjection * vec4(v, 1.0);
should be
gl_Position = viewProjection * finalWorld * vec4(v, 1.0);

In your JS code, make sure you have viewProjection declared in the uniforms.
uniforms: [‘worldview’, ‘time’, ‘frequency’, ‘worldViewProjection’, ‘amplitude’, ‘rate’],

1 Like