Hello, I am trying to have a specific camera render just the area taken up by a certain mesh - i.e. a stencil buffer (I think) to render in a mask area defined by another mesh using custom render passes (in HDRP).
The image below is an example of what I am trying to do, where a purple cube acts as the masking area and when a green sphere is dragged in front of it partially, only the area of the purple cube is rendered.
I have looked through the documentation and downloaded some examples to try and understand how custom render passes work, but I'm still struggling to figure out how to do the basic steps to achieve this goal.
What I think I have to do:
- Have a custom pass volume with the selected camera I want and a number of custom passes
- On this custom pass volume, have a DrawRendersCustomPass to specify what mesh I want to have act as the mask
- Another DrawRendersCustomPass to render only where this mask is for the specified camera
If anyone could advise me on whether this is the right way to think about or do this, I would really appreciate it!
And sorry if this is a basic thing to do - I'm relatively new and tried my best to understand the documentation and mess around with example projects but alas I am here - if there are any resources I should be familiar with please let me know!
Thank you!