How to make a material that displays specified texture always on top of mesh? I’ve found THIS, but it’s for UDK. Is there any tutorials/examples for UE4?
The material editor in Unreal 4 is almost the same, the connections are just made the other way around. All nodes you see in that video are also in Unreal 4.
First try to understand the basic idea: you take the up vector in world space, up being a vector3(0,0,1) and interpolate the result with 2 textures.
If you understand that concept you slowly start making it look even cooler.
Thanks, now i understand the idea (so far, my shader experience was limited to connecting diffuse, normal and specular maps in basic materials ) I just get the basic functionality of this shader working by getting ObjectOrientation and (0,0,1) vector (converted into world) into dot product, and then connecting it into Alpha input of Lerp node with two textures. Now i’ll try to add some parameters, etc. to make it better
Argh, i’ve just realized that it works only in object’s local space (i was mistaken by material preview window ) What i did wrong here?
Hmm, as documentation states for ObjectOrientation: “The ObjectOrientation expression outputs the world-space up vector of the object” - but connecting ObjectOrientation straight into Alpha of Lerp doesn’t work.
Btw. unfortunately, most of the nodes in the video are too blurry (even on highest quality) to see what they do
I’ve found another tutorial and followed the same node setup, and finally got it working! Thanks
I’ve got another question: Is it possible to control slope in this shader? So, for example, moss/snow texture will be mostly on flat surfaces, like around max 20 degrees slope. For now, it blends from 0 degree to 90 degree slope, and the result is that moss/snow exists also on very steep parts (just with less opacity)
You could tweak the value coming out of the dot with a power node and a multiply node (just try some numbers), after that clamp it and hook it into the lerp.
That did the trick, thank you!
Hi, is there any chance you could do a screen grab of the node setup in UE 4 please.
Hey guys, there is actually a material function made for this already called “World Aligned Blend”. You specify a blend vector (default is 0,0,1), then sharpness and bias for the blend. Its probably easier to use that than to build it from scratch.
For completeness sake though, ObjectOrientation returns the objects forward vector for me. That means 1,0,0 for unrotated objects. And you should always clamp a dot product between 0-1 before a lerp. Then you will want to add some kind of contrast settings at which point you may as well just use the function.
Thanks! + For others, HERE are some screenshots how to set up this function
There is a way simpler method, just use a World Aligned Blend function, as @RyanB answered HERE are some screenshots about how to set up this function.
Anybody knows how to ajust the bias of the blend based on Z axis??
by using scalar parameters for the “bias” and “sharpness” inputs of the world aligned blend function. it is possible to go from hard edge to completely soft.