Gem Shader - too many draw calls

Client wants the gems to look good individually, but as you might know they need to be separate meshes. This is all fine and good until the scene has like 25 diamonds per chain link. Performance is definitely tanking and there is no compromise to be made on the appearance of the diamonds. Is there a hack I can use? I tried grouping diamonds into 3s or 4s but even then the effect is lost.

Hi Andrew,
You are correct that unfortunately the meshes must be separate nodes for the effect to work, and having a large number of nodes in the scene will hinder performance.
However, as long as the gems’ meshes are not unique, the shader can optimise them quite heavily. A common pitfall when uploading a model into the platform is that the meshes are not instanced/linked despite appearing the same, and thus can’t be optimised by the shader. There’s no front-end way of checking whether they are correctly instanced at the moment, but one way to guarantee they are is the following:

  1. Import the model
  2. Open the model asset
  3. Delete all but one of the gems
  4. Duplicate one of the gems as many times as needed to replace the missing gems
  5. Ensure there are no operators added to the ‘Polymesh’ or ‘Null’ (model) nodes representing the gems
    I just tested by exporting .glb and .fbx from Blender and importing into the platform and both times it did work correctly, however I have seen it done incorrectly many times as well
3 Likes

This is excellent advice and works great with my use case (these diamonds are all the same shape). Thank you for the quick reply.

2 Likes

My pleasure. Have a great day

1 Like

Yeah, this is useful to know, thanks. (I just confirmed that Maya can export instances through FBX as well.)