Blog Archives

Shadow Maps on Omnidirectional Lights

Theoretically, using six shadow mapped spot lights to piece up a shadow casting point light is not a big deal. Especially if the light geometry calculation for deferred lighting is correct. Well, in my engine, it was not the case. 🙂

There was a hidden calculation error that resulted in a frustum with incorrect corner points that made it bigger than desired. This error caused no problem so far because projected mask texture on spotlights and “discard” codes in fragment shader prevented the extra pixels from being seen. But once I have used spot lights with no mask to render point light, the result was erroneous. It looked so strange and mysterious that it took few hours to find the root of the problem.

Finally, the shadows on point light are working now, and I proudly present some screenshots here.

Shadow map on omnilight. Shadow map on omnilight. Shadow map on omnilight. Shadow map on omnilight.

Effects, Passes, Shaders and Parameters

As I promised in an earlier post, this is a short overview about shader support in the engine. Currently Merlin3D supports OpenGL and GLSL. DirectX support is not implemented yet.

Merlin3D uses its own effect files, that describes a particular shader set for the different rendering passes (it has some similarities to .fx files in DirectX, but in OpenGL world there is no effect file support at all). Effect files are in XML format. Each visible scene object has exactly one effect required to render the object in different rendering passes. Multiple scene objects can use the same effect. Anyway, it is the recommended way of effect usage, because the engine tries to group objects by the associated effects to reduce OpenGL state changes.
Read the rest of this entry

Faster Deferred Shading

In the last two late evenings I have worked on the elimination of the 3D position from the geometry buffer, making some improvements on shader parameter passing and not surprisingly, hunting bugs down. The results are the following: Read the rest of this entry

The First Images of the Deferred Renderer

Now I’m working on the renderer and just added deferred shading to it. The implementation is far from optimal but the results are promising. The G-buffer is too “thick”, it is definitively not too effective to store the 3D eye coordinate position for each pixel, but I wanted to make it work first. The second problem is the fill rate that goes high when many visible lights are covering large areas of the rendered image. I think I will try to skip unlit pixels from the light pass by using some stencil buffer tricks or something similar.

There are multiple local omnidirectional lights and one big directional light (the sun) with ambient term for the whole scene. The bouncing projectiles are also emit light.