Posts

Showing posts from June, 2011

Screen-Space Directional Occlusion

Image
Now I have the screen-space directional occlusion working well, here's a pic :) The model I found in the standard Max scenes, I wanted some better geometry to test the lighting than my crappy programmer art. The scene has just one diffuse shadow-casting spotlight, and the SSDO provides all the rest of the colour, using the environment cube. Note the orange shining on the sides of the crazy model, with occlusion occuring in its upper fins. And the same model, with a different environment. This is going to look great when weather changes roll in, or during sunsets around planets, or going into nebulae out in space..

Screen-Space Ambient

Currently, I'm still doing a lot of this using multiple forward-rendering geometry passes, when they could instead be using screen-space techniques. I have done this so far as the performance for what I'm trying is fine, and it aids debugging greatly to be able to easily turn off entire passes. However since the lighting was added in, with arbitrary numbers of lights (5 shadow-mapped lights now being used), then engine has slowed down greatly. Time to revisit the render channels. Ambient Lighting is an obvious task here. Currently, I draw the depth/normals map, create the ambient cube map, calculate SSDO, and then - using forward-pass geometry - draw the ambient lighting into the scene, looking up SSDO and the ambient cube map. However the screen-space data is all there ready to be used - screen space normals and SSDO. Additionally, the screen-space fogging that fades the scene out to the ambient cube map is almost identical to what I want to do. So hell, let's do it!

Optimising the procedural scene generator

First of all, its crazy doing procedural scene generation and the scene graph in Python. When you're dealing with 1000's of tiles, c++ is a far better match. However, in keeping with the spirit of things, let's try and optimise the Python procedural scene first, as any high-level optimisations done are still likely to be beneficial after porting (and easier to prototype in Python!) Step 1 in any optimisation is profiling, to see where we need to optimise. Here's a snippet from my results ================================ BEFORE - 47% in RenderChannelStrip.render ================================ ncalls tottime percall cumtime percall filename:lineno(function) 3731 23.980 0.006 23.980 0.006 K:\Pegwars\current\Scripts\PyStingray\RenderChannelStrip.py:47(render) 44150 2.884 0.000 2.884 0.000 d:\Pegwars\current\Scripts\Scene\Object.py:39(bind) 287 2.862 0.010 3.243 0.011 d:\Pegwars\current\Scripts\Frustum\FarPlane.py:1