Perf Tradeoff For Circular Meshes

If I have alot of circular meshes (with different textures so they can be cloned, but not instanced), is it better to represent them as planar and then use a circular opacity texture or have a disc mesh with a fully opaque texture? In other words is it more expensive to draw more vertices, or render more alpha tested textures?

It depends a bit on device, more vertices are usually heavier on the CPU and the alpha test on the GPU, but I think in most cases the alpha test would be faster :slight_smile: But always performance test on real devices since they can throw surprises :rofl: cc @sebavan to check if I said anything wrong :rofl:

It will depend of the complexity of your vertex shader usually overdraw costs more but in case of a deadly expensive vertex shader, the alpha version might be faster.

Thanks. So if using the normal vertex shader, it’s better to make fully opaque circular mesh rather than alpha-tested planar mesh in most cases.

This isnt what you asked , but maybe helps your actual problem

.Adding Objects to a Dynamic Terrain | Babylon.js Documentation

.Babylon.js Playground

You can use a sps to manage the spheres with different textures (although its one texture using a texture atlas). It doesnt have to be used in conjunction with dynamic terrain, but as shown above, it can be. Ofc this wont work for all use cases , but if it works for yours it will be very fast

1 Like