How to render large number of similar objects?

后端 未结 2 501
误落风尘
误落风尘 2021-01-15 21:04

I have large number of objects (at least 10 000 particles) like triangles, squares, circles or spheres. Actually now I have one object which I render many times. It\'s looks

2条回答
  •  醉话见心
    2021-01-15 21:52

    Ordinarily with any sort of optimisation question, the first thing to establish is where the bottleneck is. Optimising on the CPU side is useless if the bottleneck is the shader complexity. However, as you mention 10000 draw calls which is rather excessive, I'm going to just assume that you are CPU bound.

    So top priority will be to reduce your number of draw calls. At the moment, you seem to be achieving 10000 particles with 10000 draw calls.

    Usually, when I do a particle system, all of my particles are rendered as screen facing quads (billboards) with a texture applied using a single texture atlas, and I would aim to render all 10000 particles in a single draw call.

    You describe a slightly more complicated scenario; triangles, squares and circles could all be batched together in a single indexed triangle list, although perhaps you should consider implementing your circles as a textured quad instead of as lots of triangles.

    The sphere is a bit different though because it is a relatively complicated high polygon object. If it really can't be simulated as a billboard, then perhaps you are better off looking into instancing techniques to draw all your spheres at once.

提交回复
热议问题