Chapter 14 deferred rendering with skybox

hi,

I went through all the chapters in section 1. With the section 2 I am skipping as I feel. So far I did the Instancing and just finished the multipass and deferred rendering. Instead of using the starting projects I am basically trying to incorporate everything into one project which I created at the beginning of the book instead of having many small projects.

Anyway, with the deferred rendering finished I started looking at adding a skybox to it as it is in chapter 12 and then adding a reflection based on that chapter. I added the yellow skybox so far.

At which point would I draw the skybox in the deferred rendering - in the gbuffer render pass or the composite pass?

If I render it in the GBuffer then it gets passed along in the color texture but the background after the composite pass is still black. Is it because the lighting and other fragment processing is being applied to it I am thinking? So I guess it should be rendered in the composite pass but I have absolutely no idea how.

Any help would be appreciated.

Cheers!

@mhorga Can you please help with this when you get a chance? Thank you - much appreciated! :]

I recommend doing a deferred rendering first and then a forward (normal) rendering where you will add the skybox at the end. I haven’t tried it but it should work.

I think I am having issues with depth. To make something little bit more obvious let’s say for each of my point light I want to draw an object at its position to represent the point lights visually.

So in my scene I have two pointlights and for each there is a circle at its position as you can see in the picture below. The issue is the red light is supposed to be behind one of the pillars but the rendered scene does not take that into account.

Now, if I run the drawing of the circles in the ZBuffer pass then the depth is correctly calculated and it works fine , however the lighting gets applied to it in the composition pass and I don’t want that.

So I am rendering the circles after composition pass. But the depth is not calculated correctly. I am using the same command encoder as for the composition pass as I am drawing directly into the drawable but using a different render pipeline with different shader functions.

Would this come down to the way the DepthStencilState is set up? Or would I need to draw this with a completely new render encoder where I take the textures created in the composition pass and draw into them in a completely new pass?

53

Cheers

Yes, I would just separate that in a new pass using a separate render encoder.