Download

Is BlendAngleCorrectedNormals the correct way to combine two normals?

I have a material that uses two normal maps combined to drive the refraction value of the material.

However I’m getting strange results when using flat normal maps and blending them with BlendAngleCorrectedNormals. It results in a weird normal value. Let me demonstrate with some math.

We start with two flat normal values (0,0,1) and we’ll follow the math of BlendAngleCorrectedNormals.

Normal1.b + 1
Append to Normal1.rg
Result1 = (0,0,2)

Normal2.rg * -1
Append to Normal2.b
Result2 = (0,0,1)

Dot Product of Result1 and Result 2
Result3 = (0,0,2)

Result1 * Result3
Result4 = (0,0,4)

(Result1.b + 1) * Result2
Result5 = (0,0,2)

Result4 - Result5
Final Result = (0,0,2)

So assuming my math is correct, combining two flat values using [COLOR=#252C2F][SIZE=13px]BlendAngleCorrectedNormals results in a weird normal of (0,0,2). It doesn’t make any sense. Is the result of BlendAngleCorrectedNormals supposed to be normalized?

Is this right or is there a better way to combine two normal values?

P.S. If you are wondering why I’m bothering to blend two flat normal values, let me explain. The material uses static switches to turn the normal maps on/off. When one is off, I just use a flat normal vector in its place. So there is a possibility that both can be turned off, resulting in two flat normal values which then produces strange refraction issues in the material.[/SIZE][/COLOR]

There is nothing wrong with (0,0,2), apart from it not being normalized.
Comprehensive article, fully covering the topic.

Interesting article. Thanks. I guess I’ll just normalize the result of BlendAngleCorrectedNormals then.