[UE4.15] Draw material with world position

Wasn’t sure to put this in blueprint or rendering, but I’m trying to figure out how to get world position info from a static mesh. As in when I try to Draw Material with Render Target, I want it to draw a material that uses the Absolute World Position to have different darkness depending on how high up the mesh is. But since the material I’m trying to draw don’t have any static mesh its combined with, it says the world position is 0,0,0 (I believe). So I’m not getting the right render that I want to get.

So anyone have an idea with this? Almost every time I try to search for a problem I have, I almost never find anything about it xD Its very specific, but yea the same problem is with Draw Material to Render Target.

Put with a little image showing the nodes.

Bump, no one?

I don’t understand what you’re doing here, what is the render target for? Couldn’t you just apply the material to a mesh in your scene?

Its a dynamic snow material. And to be able to add on whatever the depth info I’m getting from the render target, I would need to draw material as shown there. Like its adding together the info from each capture to make the snow stay down.

Can you post an image showing the setup of M_DepthMath?

There. I just use an Absolute World Position and mask out only the Z so it offsets in Z to always make the depth relative to the ground. It works when I just apply it to the mesh, but can’t find a way to draw that output to a render target to combine it together. If only I could use Composite Mode in the render target, but its grayed out when I use anything else except the default one.

Okay so for anyone else who wants to know, I found one way to do it. I made a blueprint where I used a 2D render and rendered to a render target the depth. Making sure I tick the box to include negative numbers. Since then I don’t get a 0-1 cap. That way I get the full accurate offset. And then I use that as a texture offset on the snow material instead of the world position node.