From 20b775e5b0a3d1e09ff6fd069c97bb6583750909 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Fri, 18 Dec 2020 11:49:49 +0100 Subject: [PATCH] Fix material id viewport mode --- Sources/arm/node/MakeMesh.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/arm/node/MakeMesh.hx b/Sources/arm/node/MakeMesh.hx index dd2b40a6..45cc5b3e 100644 --- a/Sources/arm/node/MakeMesh.hx +++ b/Sources/arm/node/MakeMesh.hx @@ -377,7 +377,8 @@ class MakeMesh { frag.write('fragColor[1] = vec4(nAttr, 1.0);'); } else if (Context.viewportMode == ViewMaterialID) { - frag.write('float sample_matid = textureLodShared(texpaint_nor, texCoord, 0.0).a + 1.0 / 255.0;'); + frag.add_shared_sampler('sampler2D texpaint_nor' + Context.layer.id); + frag.write('float sample_matid = textureLodShared(texpaint_nor' + Context.layer.id + ', texCoord, 0.0).a + 1.0 / 255.0;'); frag.write('float matid_r = fract(sin(dot(vec2(sample_matid, sample_matid * 20.0), vec2(12.9898, 78.233))) * 43758.5453);'); frag.write('float matid_g = fract(sin(dot(vec2(sample_matid * 20.0, sample_matid), vec2(12.9898, 78.233))) * 43758.5453);'); frag.write('float matid_b = fract(sin(dot(vec2(sample_matid, sample_matid * 40.0), vec2(12.9898, 78.233))) * 43758.5453);');