Why doesn't this Fake BRDF shader work?

I’m trying to recreate the fake BRDF shader described in here and / or this video. This is my graph:

Everything looked pretty straightforward, I’m using a property with a reference to _WorldSpaceLightPos0 to get the light position, however when I plug the shader into an object I get incorrect results:

4735646--448778--upload_2019-7-11_11-54-6.png

The dot product between the normals and the light direction seems to work fine as it generates the output I expect, however the dot product between the normals and the view direction seems to have something weird going on, as if I plug it directly to the color output I get overblown values:

4735646--448781--upload_2019-7-11_11-55-52.png

While, judging from the article I linked earlier, I should expect a value between 0 and 1 (1 when directly facing the normal, 0 at right angles)

Anyone could help me understand what’s going on?

Solved this myself: just needed to normalize the output of the view direction node.

1 Like

Thanks man!

This is very interesting. How can the best texture be created? The calculations look quite cheap.