0
\$\begingroup\$

I am extracting Normal Map from Texture2DArray in shader graph and then converting it to normal using Normal Unpack node. But results I get are different, compared to usual Texure2D Normal Map.

Texture2DArray Normal doesn't work correctly at all, except it just makes terrain look darker.

enter image description here

Texture2DArray is generated using TextureFormat.RGBA32 as well.

I've tried setting import settings of normal as "Normal Map" and as "Default". Normals are a bit different in both cases(When generating with import setting of "Normal Map", it becomes Red, when generating with setting of "Default", its colors are more correct), but overall results are the same - dark terrain without correct lighting in both cases.

Thanks for any help!

\$\endgroup\$
1
\$\begingroup\$

Problem was, Normal Unpacking only works with non-SRGB textures.

In order to generate non-SRGB Texture2DArray you'd need to provide last parameter(Set texture to be linear):

Texture2DArray(int width, int height, int depth, TextureFormat textureFormat, bool mipChain, bool linear = true)

But since my Texture array includes both normal maps and albedo maps, all other textures look flatter and uglier(Since they're linear now).

There are 2 ways of solving this issue:

  1. Use 2 texture arrays, one for normal maps(non-srgb) and another for albedo maps(srgb)

  2. Use non-srgb texture array, but convert albedo maps to srgb inside the shader. Either using cheap approximation: pow(col.rgb, 2.0) or built-in GammaToLinearSpace(col.rgb)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.