Draw call control of Layer

I created 100 boxes in the scene, and when I turned on highlight and glow, drawcall doubled. Is there any way to make drawcall only increase by 1? For example, RTT or other depth maps?


Because I plan to add common post-processing techniques such as outline bloom, dark color, motion blur, and halo to my scene recently, I found that when highlighting and glowLayer in babylonjs are turned on, there will be separate drawcalls. Using addExcludedMesh and addIncludedOnlyMesh together will still result in a large number of drawcalls. Do I need to turn on the default channel to enable the post-processing I need?

First of all, use intances to significantly reduce the number of draw calls - https://playground.babylonjs.com/#2FFOYQ#148

1 Like

In my scene, there may be many models that are not boxes, and even if merged during modeling, there will still be around a few hundred meshes

In this case one needs to use Glow layer and Highlight layer with discretion.
Do you need to use these layers for all meshes and are all of them visible at once?

I am not highlighting and glowing all the grids, so my current plan is to exclude models that are not highlighted or glowing. However, as I use more types of layers, such as edge lines and well depths, their drawcalls will become more numerous, and I am considering optimizing these issues

This doc section should be useful - Babylon.js docs

The effect layers (glow, highlight) work by rendering meshes into an additional render target and then by composing it with the main scene. So, you will end up with additional draw calls per mesh you add to an effect layer, there’s no way around this unfortunately.

So I wonder if RTT can be used for rendering target reuse. As far as I know, it is possible, but I haven’t put it into practice.