Jump to content
  • Advertisement
Sign in to follow this  
haiku526

OpenGL Naive deffered pipeline

This topic is 701 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Edited by haiku526

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Edited by noizex

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!