Fix sampling in material id view

This commit is contained in:
Lubos Lenco
2021-08-03 17:38:20 +02:00
parent 9961ada28e
commit f6d92f6aec
+2 -1
View File
@@ -422,7 +422,8 @@ class MakeMesh {
}
else if (Context.viewportMode == ViewMaterialID) {
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.add_uniform('vec2 texpaintSize', '_texpaintSize');
frag.write('float sample_matid = texelFetch(texpaint_nor' + Context.layer.id + ', ivec2(texCoord * texpaintSize), 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);');