Mask for base layer

This commit is contained in:
luboslenco
2020-02-18 11:47:02 +01:00
parent f281e497d2
commit 3fe791337d
3 changed files with 12 additions and 1 deletions
+9
View File
@@ -183,6 +183,15 @@ class MakeMesh {
frag.write('metallic = 0.0;');
}
if (l.texpaint_mask != null) {
frag.add_shared_sampler('sampler2D texpaint_mask');
frag.write('float maskTexture = textureLodShared(texpaint_mask, texCoord, 0.0).r;');
frag.write('basecol *= maskTexture;');
frag.write('occlusion *= maskTexture;');
frag.write('roughness *= maskTexture;');
frag.write('metallic *= maskTexture;');
}
if (l.maskOpacity < 1) {
frag.write('basecol *= ${l.maskOpacity};');
frag.write('occlusion *= ${l.maskOpacity};');
+3
View File
@@ -508,6 +508,9 @@ class RenderPathPaint {
path.bindTarget("texpaint" + tid, "texpaint");
path.bindTarget("texpaint_nor" + tid, "texpaint_nor");
path.bindTarget("texpaint_pack" + tid, "texpaint_pack");
if (Project.layers[0].texpaint_mask != null) {
path.bindTarget("texpaint_mask" + tid, "texpaint_mask");
}
for (i in 1...Project.layers.length) {
var l = Project.layers[i];
tid = l.id;
-1
View File
@@ -330,7 +330,6 @@ class Uniforms {
}
if (link.startsWith("_texpaint_mask")) {
var tid = Std.parseInt(link.substr(link.length - 1));
trace(tid);
return Project.layers[tid].texpaint_mask;
}
if (link.startsWith("_texpaint_nor")) {