Reading CustomDepth buffer in translucent materials using orthographic camera?
I've created a translucent material where I intend to read from the CustomDepth buffer, and use this data to control whether certain the rendered texture is translucent or not. Essentially, the idea is to mask the parts of certain actors that do NOT overlap with my actors that render to the CustomDepth buffer. Clipping sprites with other sprites, if you will.
I'm using an orthographic camera.
All my sprites are unlit.
I've got the following material down:
And I've set an actor to render to the Custom Depth buffer, which I verified in the editor, and in game using the "r.BufferVisualizationTarget CustomDepth" console command:
However, none of my actors that are using my custom material seems to care about this custom depth buffer, which I've tried to visualize with the following material:
With this material applied to my actors NOT rendering to custom depth, they show as 100% white, not changing their color depending on whether or not they overlap the rendered data in the CustomDepth buffer.
What gives? What am I doing wrong here?
I first thought that maybe my orthographic camera couldn't render to the CustomDepth buffer, but visualizing that buffer seems to show that indeed it can.
asked Jan 17 '17 at 08:05 AM in Rendering
Nevermind, turns out I was parsing the depth value incorrectly, with regards to how my orthographic camera was set up. Turns out, reading from the custom depth buffer inside translucent materials is totally fine and works like you expect. :)
answered Jan 18 '17 at 01:05 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here