0
\$\begingroup\$

I have a material with an existing normal map. I added a secondary normal map to represent damage via script. I assign to the appropriate texture property _DetailNormalMap, assign the required keywords, _DETAIL_MULX2 _NORMALMAP, and set a scale via _DetailNormalMapScale.

I have ensured there is a material in the resources folder with the same settings, to ensure that the variant is available in builds, though this shouldn't be an issue in editor.

However, it does not show up, at least not initially:

Missing secondary normal.

If I do darn near anything with it in the editor, even alt+tabbing, will cause the secondary normal map to show up:

Normal map visible

I recall back in the day keywords were the issue, but I clearly have done that. I recall this working in the past. I am still using Unity 2018.4.6f1, so I would be surprised if there are any major changes.

Thanks for your assistance.

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

Turns out the issue was that a constant that represented the keyword was updated to have two keywords instead of just one. In effect, we were doing:

material.EnableKeyword("_DETAIL_MULX2 _NORMALMAP");

Instead of:

material.EnableKeyword("_NORMALMAP");
material.EnableKeyword("_DETAIL_MULX2");

Both _NORMALMAP and _DETAIL_MULX2 are required for the secondary normal map to work, and they each must have their own call from EnableKeyword.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .