Transparent rays test
This commit is contained in:
@@ -89,7 +89,11 @@ class MakeMesh {
|
||||
|
||||
if (Context.layer.paintBase) {
|
||||
frag.add_shared_sampler('sampler2D texpaint');
|
||||
frag.write('basecol = textureLodShared(texpaint, texCoord, 0.0).rgb;');
|
||||
frag.write('vec4 texpaint_sample = textureLodShared(texpaint, texCoord, 0.0);');
|
||||
#if kha_direct3d12
|
||||
frag.write('if (texpaint_sample.a < 0.1) discard;');
|
||||
#end
|
||||
frag.write('basecol = texpaint_sample.rgb;');
|
||||
}
|
||||
else {
|
||||
frag.write('basecol = vec3(0.0, 0.0, 0.0);');
|
||||
|
||||
@@ -196,7 +196,8 @@ class MakePaint {
|
||||
frag.write('float occlusion = $occ;');
|
||||
frag.write('vec3 nortan = $nortan;');
|
||||
frag.write('float height = $height;');
|
||||
frag.write('float opacity = $opac;');
|
||||
frag.write('float mat_opacity = $opac;');
|
||||
frag.write('float opacity = mat_opacity;');
|
||||
if (Context.layer.material_mask == null) {
|
||||
frag.write('opacity *= brushOpacity;');
|
||||
}
|
||||
@@ -322,7 +323,11 @@ class MakePaint {
|
||||
frag.add_uniform('sampler2D texpaint_pack_undo', '_texpaint_pack_undo');
|
||||
frag.write('vec4 sample_nor_undo = textureLod(texpaint_nor_undo, sample_tc, 0.0);');
|
||||
frag.write('vec4 sample_pack_undo = textureLod(texpaint_pack_undo, sample_tc, 0.0);');
|
||||
#if kha_direct3d12
|
||||
frag.write('fragColor[0] = vec4(' + MaterialBuilder.blendMode(frag, UITrait.inst.brushBlending, 'sample_undo.rgb', 'basecol', 'str') + ', mat_opacity);');
|
||||
#else
|
||||
frag.write('fragColor[0] = vec4(' + MaterialBuilder.blendMode(frag, UITrait.inst.brushBlending, 'sample_undo.rgb', 'basecol', 'str') + ', 0.0);');
|
||||
#end
|
||||
frag.write('fragColor[1] = vec4(mix(sample_nor_undo.rgb, nortan, str), matid);');
|
||||
if (Context.material.paintHeight && MaterialBuilder.heightUsed) {
|
||||
frag.write('fragColor[2] = mix(sample_pack_undo, vec4(occlusion, roughness, metallic, height), str);');
|
||||
|
||||
@@ -1424,6 +1424,9 @@ class Material {
|
||||
else {
|
||||
textureMap.set(tex_store, 'texture($tex_name, $uv_name.xy)');
|
||||
curshader.write('vec4 $tex_store = texture($tex_name, $uv_name.xy);');
|
||||
if (!tex.file.endsWith(".jpg")) { // Pre-mult alpha
|
||||
curshader.write('$tex_store.rgb *= $tex_store.a;');
|
||||
}
|
||||
}
|
||||
|
||||
if (sample_bump) {
|
||||
|
||||
Reference in New Issue
Block a user