I’m trying to create a material for a landscape by following the UDEMY tutorial that epic promoted a little while back. In the tutorial we’re asked to create two material functions. One for Grass and one for Dirt. In the material function there’s a near distance and far distance set up that is blended together using a BlendMaterialAttributes node.
The Alpha of the BlendMaterialAttributes node has some math nodes with an absolute world position and a camera position. Here’s a pic of that set up.
I’d rather use the Distance Blend function though but when I plug it into the Alpha and save the function, the landscape compiles and shows the grey checkerboard texture but doesn’t call any errors. Is there something I’m missing?
I’ve tried re-applying the materials to the landscape and the issue persists (usually crashes). when I plug the Distance Blend directly into the BaseColor of the SetMaterialAttributes just before the Output I can see the function working properly in the preview window. When applied it to the landscape just sticks on the grey checkerboard still. texture.
Wow, that was a super quick response, haha. Since it’s a part of paid content I don’t feel super comfortable with posting it. I’ll see if I can reach out to the creator of the tutorial series and get their permission first.
When I tested this by setting the blend mode to Translucent it did render the material with the textures correctly.
The documentation for Depth Expressions only lists SceneDepth as Translucent only.The Distance Blend function uses PixelDepth though. Should the documentation be updated or is this a bug?
I don’t see anything else in the expression that ties it to Translucent blend modes to my knowledge. I also created a very simple Material that was opaque using a lerp and two 3V and texture inputs for color and the distance blend node and it works as expected.
You might want to show the whole material, because what I see should work (if you also setup the BlendMaterialAttributes correctly).
(And yeah, I would trust Epic in this case and use the function, I’m not sure, but it I think the PixelDepth is somewhere saved already, so you don’t have to calculate it again.)