Use opacity mask to hide 'occluded' pixels too
I have designed a material which drives the opacity of a material (actually using the Opacity Mask slot) using an algorithm which involves the camera's forward vector.
This material works fine, but now when surfaces are being masked out there are other parts of the object behind that surface which are being rendered, and I don't want them to be!
So basically, parts of the object which would have been occluded by the rendered surface are now visible, despite the material shader setting the Opacity Mask to 0 for the pixel on top.
I'm assuming there will be a way to solve this using a custom depth buffer so that the Opacity Mask material works only on the 'closest' pixels but I was hoping there may be a material expression to make this task easier and cheaper?
Basically what I need to do is either have an object's pixel fully opaque or transparent based on the output for the closest (depth wise) pixel. If that calculates to transparent (Opacity Mask=0) then I don't want to render any part of that object behind it.
Probably sounds quite confusing! but I'm hoping someone out there will know what i mean and have a solution...?
asked Feb 24 '18 at 05:23 PM in Rendering
Follow this question
Once you sign in you will be able to subscribe for any updates here