I had some problems on other levels, everything was pitch black… after trying to correct that for a few hours I finally decided to clean up everything… and the problem disappeared, I guess there was something bad happening in my code
Here’s a video of the start of the second level of Alien Blitz
Combining old & new
And now for some new tests I wanted to try to combine the old render and the new one, basically I will first render exactly as before, and add shadows on top of it (removing the new lights calculation, just using shadows). So wall shadows will be rendered twice (old + new).
Old / old + new :
Just re-rendering second level :
So basically it’s the same as before except there are more shadows and they are more accurate. The down side is that everything is a bit darker, but not as much as I was expecting.
In previous videos/screenshots I was using a 1024px depth map, so there was not that much aliasing, but I think for performance reasons the quality should be selectable. But at lower resolutions aliasing appear.
256 / 512 / 1024 px depth maps :
(Aliasing is not very visible on the thumbnails)
This test case is probably the worst that could happen, the light is just a little higher than ground a few meters away. I tried various PCF techniques (adapted to cube maps) but nothing really worked. One possible way to solve this could be to use a bigger viewport for shadow frame buffer.
512px depth map, x1 viewport / x2 viewport :
Using a x2 viewport makes small artifacts blend, this is indeed nicer, I couldn’t see a difference with x4 so it’s not included
I also tried mixing PCF in the different processing steps, but got nothing really good.
So I think I will stick to something like :
- No shadows : same as current
- Low quality : 256px depth map, x1 viewport
- Medium quality (default) : 512px depth map, x2 viewport
- High quality : 1024px depth map, x2 viewport
And I might change some levels to avoid problems in low quality (for example adding a small wall around the path might help in above case)
Updated video, with new render & medium quality shadows
I had some problems on Android, textures were not read properly, nothing was working. The problem was quite stupid, it’s just that I wasn’t binding my textures correctly, I guess it worked on desktop because MAX_TEXTURES might be higher.
Now shadow mapping seems to work exactly the same on my Nexus 7 as on PC, but still nothing on my Nexus 10 (black screen, empty depth map, empty shadow buffer), still needs some debugging.
Anyway it’s way too slow to do anything (even with caching), but I just want to make sure I can get it to work in case I do a tutorial later.