I am working on a project which has approximately 100-150 textured meshes with
PBRMaterial in a scene. Most meshes are similar but I cannot use instances because the user will be able to customize the texture, glossiness and color of each mesh separately.
I have implemented a texture pool so that I don’t create a new PBR if I have already created it. But even if I might use a single instance of the
PBRMaterial for 100 meshes, when I check the number of textures in the scene I get a
ShaderMaterial instance for each textured mesh (I have not added a custom ShaderMaterial). Is there a way for all the meshes to use the same instance? Or any workaround to improve the rendering performance when rotating the camera around? It makes the ux unpleasant…
Thanks in advance
This is really strange you are getting ShaderMaterial in this case. Could you share some kind of repro ?
I will try but I cannot import the 3D models I am using in the playground. I forgot to mention that all the meshes are imported from Blender. Could the ShaderMaterial be imported from Blender?
I do not think so as it should either be standard or pbr materials.
Hello @pikachu just checking in, are you still having issues?
Hi @carolhmj, thanks for asking
I wasn’t able to find where the ShaderMaterial was being created so I worked around it by manually disposing all the ShaderMaterial-s present in the scene through Babylon