venerdì 21 agosto 2015

Day 49: Cubemap shadows in depth buffer

Today I decided to move the cubemap for the shadows from the color buffer to the depth buffer.

That's because you don't really need 32 bits for storing the depth, and only the depth buffer allows you to have 16 bit values.

To do so I had to tweak a few things, for example I needed to remap the distance between fragment and light to the interval [0;1], because the depth buffer can only accept those buffers.

In the end everything was unexpectedly working in less then an hour, which is a relief after the last week. Now I'll stop working on point light shadows, and probably I will add spotlights (with the relative shadows), and then stop working on graphic stuff for a while, and move to other aspects of the engine.

In the picture I have 9 dynamic lights (10 with the directional light) casting lots of shadows from 121 parallelepipeds. It runs at 50 fps, which is quite good on my card I guess, considering that each light requires 6 renderings.
I doesn't surprise me that even in modern games there are just a few lights on screen in the same moment, and not all of them are shadow casting.


Nessun commento:

Posta un commento