Download

Material blend depending on the angle the player looks at it

Hi there!
I was wondering if there is a way to lerp two textures in a material depending on the angle from which the player looks at it. Here is a terrible drawing to illustrate:
c1bbea27d808a53a1756074e2c36eb4ce22b49c7.png
The usecase is a bit complicated. I have a beach scene with a lot of rock foliage. Because its a VR project the rocks have a cull distance and vanish in the distance. Otherwise I don’t get 90fps. So I wanted to fake the foliage stones in the distance by adding a stonetexture to the landscape material which starts to blend in, when the real foliage ends. This works well with distance based blending (pixel depth node). The problem is that the “sun” in the scene is quite low and i have a lot of shadows on ONE side of the rock foliage. So depending on where I am standing, the fake stone texture has to be bright or in shadows - which means two different stone textures depending on viewing angle. Uff… :stuck_out_tongue:

StoneBeach.png
Thanks for any help!
andtheand

in your material do a dot product between the camera vectory and an arbitrary vector and you’ll be able to use it as a mask in a lerp
work your way up from there and you’ll surely achieve what you need

Thanks! I will try and post the solution if it works

ok, that wasn’t so hard:
CameraAngleBlend.png

thanks again!