Fix T62839 object scale changes normal map output in eevee

Was using the wrong vector length.
This commit is contained in:
Clément Foucault 2019-03-22 14:30:37 +01:00
parent b0c40de5ee
commit f6a6770f06
Notes: blender-bot 2023-02-14 09:21:21 +01:00
Referenced by issue #62839, object scale changes normal map output in eevee
1 changed files with 2 additions and 2 deletions

View File

@ -1008,8 +1008,8 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
input->attr_id, use_geom ? "g" : "", input->attr_id);
/* Normalize only if vector is not null. */
BLI_dynstr_appendf(
ds, "\tfloat lvar%d = dot(att%d.xyz, att%d.xyz);\n",
input->attr_id, input->attr_id, input->attr_id);
ds, "\tfloat lvar%d = dot(var%d%s.xyz, var%d%s.xyz);\n",
input->attr_id, input->attr_id, use_geom ? "g" : "", input->attr_id, use_geom ? "g" : "");
BLI_dynstr_appendf(
ds, "\tvar%d%s.xyz *= (lvar%d > 0.0) ? inversesqrt(lvar%d) : 1.0;\n",
input->attr_id, use_geom ? "g" : "", input->attr_id, input->attr_id);