I am currently using 2 instancedstaticmesh to spawn a lot of objects in my game. But the problem is, the culldistance doesn’t seem to work. I am able to see the objects and they are being rendered at every distance.
I set the cull distance with something like this
AsteroidMesh0->SetCullDistances(50, 100);
AsteroidMesh1->SetCullDistances(50, 100);//I have set the value low just to test
I even tried to manually set each individual distance but they still don’t work.
For Instanced Static Meshes you will need to set the PerInstanceFade Amount Node in their Materials to get them to cull according to your set numbers. All you would need to do is to set the Material to Masked and plug in the PerInstanceFadeNode into the Opacity Mask and compile the material. This same node would be needed to be added to all LOD materials as well.
I did some tests on this when 4.7 came out. Placed ~10 mil cubes, first with opaque and then with fade-based masked materials and if anything the masked seemed to work slower.
Mind you I have done it out of curiosity and it wasn’t an extensive test so I might have missed something.
I’m not sure if you’re still looking, but a google search for a related query got me here so I figured I’d help out. I’m not sure which UE4 version introduced this, but the answer to your question is to use Hierarchical Instanced Static Mesh actors in your blueprint. They function the same as Instanced Static Mesh actors, but support LODs and distance culling.
The reason a masked material worked slower than the non-masked one was because you’re not actually stopping the drawing of the mesh but rather adding transparency into the mix. the object is still drawn and the pixel shader is doing more work. the end result is that the meshes are invisible, but the GPU is doing more work to get there.