Jump to content
  • Advertisement
Sign in to follow this  
demontf

OpenGL Deferred Shading

This topic is 2751 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 guys!

I've been trying to implement deferred shading in my project but further than filling G-Buffers I couldn't make it! I have read every single article and sample code that I found. I just can't make lighting stage work in 2D orthographic projection camera using screen resolution dimensions. If i try to render the normals G-Buffer part than i get just like on the picture below.

If anyone has working example on Direct3D (OpenGL is not acceptable), PLEASE let me have a look on it! :)


It should be three boxes, one on the top of two others

[attachment=1591:??????????.jpg]

Share this post


Link to post
Share on other sites
Advertisement
To me that looks a lot like you've rendered your normals to the texture you're using on your cubes...

I'd double check you're setting up your Render Targets correctly and then that you're applying thr correct texture when you draw your cubes.

Share this post


Link to post
Share on other sites

To me that looks a lot like you've rendered your normals to the texture you're using on your cubes...

I'd double check you're setting up your Render Targets correctly and then that you're applying thr correct texture when you draw your cubes.

Yeah, you're right. I just wanted to render normals to see if i correctly calculated previous stage. But I really confused how to get corresponding pixel in this normals texture for every pixel in pixel shader while calculating lighting

Share this post


Link to post
Share on other sites
Instead of these cubes you need to draw a single rectangle that you align to the screen via the vertex shader. You can than use the vertex positions (0.5 * position.xy + 0.5) or predefined texture coordinates as your texture coordinates that you are sending to the pixel shader where they can be used.

Share this post


Link to post
Share on other sites
OK! I'll try that. Instead of this a render geometry once more in lighting stage. My bad :)

Thanks! Hope it'll work

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!