1
$\begingroup$

In deferred rendering, I first write world position to G-Buffer, and then in shading part, I want to use that information to reproject in the previous frame and then write the final color.

However, the world position buffer wont have any values for fragments that are not touching geometry. How can I recognize these fragments without valid world position info in deferred lighting shader? E.g. I should be displaying environment instead of black parts in world pos buffer.

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Broadly speaking, the way to deal with this is to check the depth value for that position on the screen. If the value is the value you cleared the depth buffer to, then you didn't write anything to that fragment.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.