giovedì 24 dicembre 2015

Day 106: Automatic batching, another step

Today I continued to automatize the batching process. I'm almost at the point where the batch will become identical for whaterver shader I will decide to use, and that is the goal, so that I will be able to build custom shader and just use them with the same batch.

I did really a lot of stuff today, I'm actually having troubles remembering what I did, and if i did it today. Most of the time was spent fixing bugs and scratching my head, because it's a very delicate work, and each change I make is potentially critical.

Now the system is finally able to automatically divide the models into batches. Before I had a sorting algorithm, where the ">" function was manually defined to suit the default shader. Now the ">" function used by the sorting actually compares the uniforms from the two models, and so it is valid for whathever shader.

The performance is not bad, they fps are slightly lower than before, but there is a reason for that: among the uniforms are also the View matrix and the ViewProjection matrix, so they are compared as well. However they are 100% identical among all the materials. When (and if)  everything will be working, I'll introduce a way to declare "global uniforms", which are set to the shader itself, instead of the model. This will reduce the duplication of data and the time used by the sorting algorithm.

In the picture you can se 4 emitters, each one of them spawns particle with a different mesh and texture/normal map. The drawcalls are 4, which is exactly what should be expected.



Nessun commento:

Posta un commento