Hey guys. I usually lurk, but I'm having some trouble with a postprocess material I've been working on. I'm trying to selectively mask zdepth in relation to the current location of the pixel being drawn, or pixeldepth/destdepth if that makes sense.
The problem is, I've done a lot of research and tried a few methods but I can't get the material to dynamically update in realtime. It's driving me nuts. I've isolated the area in the shader network here:
And here's an image of the scene with the material applied:
It's hard to show/explain(this really isn't my strong suit), but moving around and pointing at objects at different depths doesn't change the offset of the SceneDepth mask, and I'm not sure why?
Any advice is super appreciated, and if I'm not being clear I'll try explaining further.
Replies
Kind of, I'd like the distance to the object under the crosshair be the starting point for the depth mask. Which is pretty similar to what you said.
As I understand it, DestDepth is the distance of the pixel being drawn under the crosshair, so I figured plugging that into a Distance node with a Camera World Pos would update that distance as the crosshair moved, in turn changing the offset of the depth mask I had. I'm doing something wrong clearly though. Is there a better way to get a "selective" depth of field style mask?
My goal is to do this purely with the nodes available in the material editor, so no custom nodes.
If you want your DOF to dynamically adjust it's focal point depending on where you aim, I can't think of any way to do that with the default material editor nodes. You would probably have to do some Unreal Scripting to get that type of feature.