Wave Engine’s Rendering System
Wave engine uses Light-Pre pass Deferred Rendering system to represent dynamic lights starting from version 2.0. This technique is very powerful because allows you to render multiple dynamic lights but it is more expensive than using lightmaps to represent static lights, so you must choose what technique is more appropriate to use for your game.
We are going to research how many “draw calls” are need to draw a simple Entity with texture without dynamic lighting:
There is 1 draw call to draw a textured box entity; however, if we add a dynamic light to the scene and active LightingEnable property on box material:
Now we need 3 draw calls to draw a lighting textured box entity; a G-Buffer pass, a lighting pass and forward rendering pass.
We will research now how many draw calls are need to draw multiple textured entities without lights.
There are 2 draw calls, one for every entity. You can imagine what it will take if we add a dynamic light to the scene? Maybe you would guess that 6 draw calls will be necessary for dynamic lighting case:
It took 5 draw calls to draw a frame; 2 G-Buffer pass, 1 Lighting pass and 2 forward rendering pass (for every entity). This is because only one lighting pass for every light is necessary for multiples entities.
If we add an orange light and a green one to the scene, then:
There are 6 draw calls to actually draw a frame: 2 G-Buffer pass, 2 Lighting pass (one for every light) and 2 forward rendering pass (one for every entity).
Conclusion: if your game doesn’t need dynamic lighting is more efficient to use a lightmap texture to represent lights and shadows. In the other hand if you use dynamic lights it’s important to notice the more lights on your scene the more expensive to draw.
This is the first “how to improve the performance on your games" article, in the second part we will analyze the static and dynamic batching techniques that allow you to draw multiples entities with only one draw call as well as the advantages and limitations of these techniques.