diff --git a/leenkx/blender/lnx/material/make_finalize.py b/leenkx/blender/lnx/material/make_finalize.py index d549fff..9760e3c 100644 --- a/leenkx/blender/lnx/material/make_finalize.py +++ b/leenkx/blender/lnx/material/make_finalize.py @@ -75,14 +75,6 @@ def make(con_mesh: ShaderContext): vert.write('eyeDir = eye - wposition;') frag.write_attrib('vec3 vVec = normalize(eyeDir);') - export_wpos = False - if frag.contains('wposition') and not frag.contains('vec3 wposition'): - export_wpos = True - if tese is not None: - export_wpos = True - if vert.contains('wposition'): - write_wpos = True - if export_wpos: vert.add_uniform('mat4 W', '_worldMatrix') vert.add_out('vec3 wposition') @@ -91,6 +83,9 @@ def make(con_mesh: ShaderContext): vert.add_uniform('mat4 W', '_worldMatrix') vert.write_attrib('vec3 wposition = vec4(W * spos).xyz;') + if frag.contains('dotNV') and not frag.contains('float dotNV'): + frag.write_attrib('float dotNV = max(dot(n, vVec), 0.0);') + frag_mpos = (frag.contains('mposition') and not frag.contains('vec3 mposition')) or vert.contains('mposition') if frag_mpos: vert.add_out('vec3 mposition')