Tag Archives: HLSL

XNA: Adding fog to a LPP (or deferred) pipeline

Hi folks, After a long delay, here is one more gift for you: how to add fog to your scene. I will talk about global fog, although it can be easily extended to local fog volumes like spheres, cubes, etc. … Continue reading

Posted in XNA | Tagged , , , , | 39 Comments

Light Shafts + Tone Mapping

Greetings strangers! This time I will show you a simple approach to an effect that will help our renderer to have a more “artistic” look: the light shafts, also known as god-rays. Needless to say that the source code + assets are … Continue reading

Posted in XNA | Tagged , , , , , , , , | 33 Comments

XNA Light Pre-Pass: Instancing

Almost anyone out there wants to output as many meshes/triangles/details as possible. We know that individual draw calls can hurt performance, so it would be nice if there was a way to draw lots of meshes using a single draw call. … Continue reading

Posted in XNA | Tagged , , , , , | 27 Comments

XNA Light Pre-Pass: ambient light, SSAO and more

Hi folks, I’ve added a few improvements to the LPP renderer, to make it shine: ambient lighting using cubemaps, SSAO, an example of a dual-layer shader and some other small changes. Here is a screenshot: As usual, the full source … Continue reading

Posted in XNA | Tagged , , , , , , | 22 Comments

XNA 4.0 Light Pre-Pass: shedding the light

After my last post, I decided to continue with the z-reconstruct approach and to use light-meshes where possible. I’ve implemented two more light types: directional and spot. You can get the source code here. Here is a screenshot of the … Continue reading

Posted in XNA | Tagged , , , , , , | 11 Comments

XNA 4.0 Light Pre-Pass: Optimization Round One

Following some suggestions on my previous posts, I decided to reconstruct the z-buffer from my linear depth buffer and optimize the lighting pass. To achieve this, I did the following steps: Changed the light-accumulation render target: now it has also … Continue reading

Posted in XNA | Tagged , , , , , | 2 Comments

Reconstructing view-space position from depth

After my first LPP implementation, I decided to go for the mesh-based approach for rendering point lights. It consists in rendering a convex mesh (usually a sphere) that fits the light’s volume. This way we can use some depth/stencil tricks … Continue reading

Posted in XNA | Tagged , , , , | 3 Comments