Naive deffered pipeline

Started by
2 comments, last by haiku526 7 years, 8 months ago

Hi,

I just thinking about simple/naive defferend rendering implementation and I like to consult, if is my ideas correct.

So Im going to have color, depth, normal buffers.

Every my "entity" in scene graph have pair of vertex and pixel shader with final "program" reference.

So I have to do first pass which will iterate over entities, binds their programs, bind color buffer and draw the one by one.

After that I have to fill for example normal buffer, so I will iterate again, but I have to "swap" the pixel shader of every entity with my "normal" pixel shader. But this is going to be expensive right? To compile, in OpenGL terms, the program with new fragment shader (maybe I can do it upfront?).

Suppose for now this is correct way and I will do next pass which will fill depth buffer in same way.

After these passes I have to bind "screen quad" entity (suppose we don't use lighting right now) and bind those buffers (color, depth, normal) and write shader which will combine information from those buffers and outputs final image.

So my questions are - what is the "best practice" how to fill my custom (color, depth, normal, maybe so more) buffers? Also - is this flow as whole right?

Thank you for help!

Advertisement

I'm not a graphics programmer, but in my experience you'd have a single shader which outputs to each of the render targets (albedo, normal, etc) in the same pass.

Exactly, you do one geometry pass (naively, not mentioning special cases here) and write to several gbuffers (textures) at once. I suggest reading some tutorials about deferred rendering to get a better grasp on this concept, there are several out there, even specifically about OpenGL:

http://ogldev.atspace.co.uk/www/tutorial35/tutorial35.html

http://learnopengl.com/#!Advanced-Lighting/Deferred-Shading


Where are we and when are we and who are we?
How many people in how many places at how many times?

Thank you! I didnt knew about MRT technique, thanks again.

This topic is closed to new replies.

Advertisement