Obtaining 3d bounds of overlapped depth stencil

Hi, I was wanting to see if there is a method for obtaining the bounds for the red portion only of this Unreal Engine 4 Tutorial - Custom Depth - YouTube video. I wanted to do some additional rendering on the non-visible edge but I am not sure how I would go about obtaining coordinates for its bounding radius. Any help would be appreciated!

Make a material collection with a vector paramter

You can get the dimensions of an object from with it’s blueprint and pass it on to the collection (set the variable as a material collection and pick the newly created one)

You can now access the dimensions of the object from within a material dragging in the collection and choosing the variable

Thank you for your reply!
I think I might be slightly asking the wrong question.

I really would just want the location coordinates of that red mesh box extent outside of the material. I definitely have access to the overall object box coordinates, not sure how I would attempt to clip it to recieve just the red portion. Not sure if the approach is similar to what you have posted (I am new to Unreal :frowning: ). Additionally, there a lot of these objects and I guess another question is how to associate each object with its own red mesh coordinates when I am using the post process volume.

Which type of coordinates are you looking to get? 2d screen space coordinates (based on image) or world-space 3d coordinates?

I have a 3d->2d conversion function already so technically either works for my case. In the end, it needs to be 2d

In theory you could pass the information from the post processing to a render target texture and then analyze its output to retrieve the needed information (probably use unique colors per tested object). Then you could scan the image to find the needed pixels and see where they end on the y and x axis to gather their dimensions.

It would probably need to be done in c++ to get the best performance.

I was afraid of this soultion (was hoping for some material wizardy). For anyone in the future, this is how my original implementation was going to be. You can make it faster by taking the object of interest’s 2d screen space and then doing a for-loop on just those pixels in the render target texture. If you don’t do this, and color objects similarly, they will either a) result in 1 large cluster or b) not be calculated.