Fix layered particle blending

This commit is contained in:
Lubos Lenco
2021-05-18 16:53:39 +02:00
parent 811b5fc2a0
commit ec7485ea6c
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ class MakeMesh {
depth_write: layerPass == 0 ? true : false,
compare_mode: layerPass == 0 ? "less" : "equal",
cull_mode: (Context.cullBackfaces || layerPass > 0) ? "clockwise" : "none",
vertex_elements: [{name: "pos", data: "short4norm"},{name: "nor", data: "short2norm"},{name: "tex", data: "short2norm"}],
vertex_elements: [{name: "pos", data: "short4norm"}, {name: "nor", data: "short2norm"}, {name: "tex", data: "short2norm"}],
color_attachments: ["RGBA64", "RGBA64", "RGBA64"],
depth_attachment: "DEPTH32"
});
+3 -3
View File
@@ -303,7 +303,7 @@ class MakePaint {
frag.write('if (opacity == 0.0) discard;');
if (Context.tool == ToolParticle) { // particle mask
if (Context.tool == ToolParticle) { // Particle mask
frag.add_uniform('sampler2D texparticle', '_texparticle');
#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
frag.write('float str = textureLod(texparticle, sp.xy, 0.0).r;');
@@ -311,7 +311,7 @@ class MakePaint {
frag.write('float str = textureLod(texparticle, vec2(sp.x, (1.0 - sp.y)), 0.0).r;');
#end
}
else { // brush cursor mask
else { // Brush cursor mask
frag.write('float str = clamp((brushRadius - dist) * brushHardness * 400.0, 0.0, 1.0) * opacity;');
}
@@ -359,7 +359,7 @@ class MakePaint {
frag.write('metallic = 0.0;');
frag.write('matid = 0.0;');
}
else if (decal || Context.brushMaskImage != null) {
else if (Context.tool == ToolParticle || decal || Context.brushMaskImage != null) {
frag.write('fragColor[0] = vec4(' + MakeMaterial.blendMode(frag, Context.brushBlending, 'sample_undo.rgb', 'basecol', 'str') + ', max(str, sample_undo.a));');
}
else {