Material
The idea is quite simple. Offsetting the height map along the light direction and comparing it's value with the actual height determines which areas are shadowed. Scale and darkness/hardness of shadows can be controlled by adjusting the offset and contrast value.
The technique is not very expensive - adding an extra of 5-10 point light shader instructions (depending on the contrast value). It's possible to save some instructions by adding a constant clamp (0-1) before the contrast adjustment and by replacing the power node with a series of multiply nodes (e.g. 3x multiply by itself = power of eight).
Screenshots
Hey m8 :)
ReplyDeleteThe material look awesome :D
I've made the material but I don't understand how to setup the "constant clamp instruction -1" node ?
Can you plz elaborate more on this & explain the value to put to achieve -1 :o
Hi mate,
ReplyDeleteboth constant clamp nodes have a min value of 0 and a max of 1. You don't necesseraily need the first one, but it does decrease the material instruction count by 1. So nothing special, just add a constant clamp and leave as it is.
cheers
Ah, now that I understand it decrease the material instruction count, it's great! THX again m8 :)
ReplyDeleteVery good technique, but why after build lighting all the shadows disappear
ReplyDeleteIt's a little bit late to answer but it's because static lights does not have coordinate information stored after building.
ReplyDeleteThe closest one to use instead standart lights is toggleable lights.
The reason is, there is no light vector with fully static lights (e.g. a regular point light).
ReplyDeleteLights labeled with D/S (e.g. dominant directional light, toggleable lights) should let you use static lighting but with a dynamic lighting component.
This is not only beneficial for this technique but also to have dynamic specular highlights instead of the pre-baked/lightmapped ones.
Is this achievable in UE4? (Im a noob when it comes to shaders, i tried to mimic your set-up, but got no results).
ReplyDelete