1

when do we create a separate renderpass in vulkan for same scene? if we have to implement shadow mapping, can't we create 2 subpasses and FBO with 3 attachments first being for depth pass and rest of the 2 for normal scene rendering? I saw some tutorials which are using separate renderpass for shadow mapping, but i couldn't understand why?

1 Answer 1

2

You cannot sample arbitrarily from an input attachment. This means that in the fragment shader you can only get the sample values from the input attachment corresponding to the fragment you are shading.

If you want to sample from another location you cannot use it as an attachment inside the same renderpass.

Sign up to request clarification or add additional context in comments.

2 Comments

so the only case where we can use sub-passes are deferred shading? we cann't even use it for post processing effect?
As long as the post processing does not sample from a differing (fragment) position you can still use sub-passes, but if you need to sample from neighboring (or arbitrary) fragments then no, you can't use sub-passes for that. But there are several use-cases other than deferred shading that sub-passes can be used for, e.g. multi-pass stuff like OIT, passes that read depth for comparison, etc.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.