Skip to content
Snippets Groups Projects
Commit ae65d99d authored by vyacheslavsproductengine's avatar vyacheslavsproductengine
Browse files

MAINT-4446 FIXED R2 (Alpha masking does not work when ALM is enabled if the...

MAINT-4446 FIXED R2 (Alpha masking does not work when ALM is enabled if the object has a legacy bump set.)
parent afb08192
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ out vec4 frag_data[3]; ...@@ -31,6 +31,7 @@ out vec4 frag_data[3];
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
uniform sampler2D bumpMap; uniform sampler2D bumpMap;
uniform float min_alpha;
VARYING vec3 vary_mat0; VARYING vec3 vary_mat0;
VARYING vec3 vary_mat1; VARYING vec3 vary_mat1;
...@@ -47,16 +48,23 @@ vec2 encode_normal(vec3 n) ...@@ -47,16 +48,23 @@ vec2 encode_normal(vec3 n)
void main() void main()
{ {
vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
vec3 tnorm = vec3(dot(norm,vary_mat0), if (col.a > min_alpha)
{
col *= vertex_color.rgb;
vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
vec3 tnorm = vec3(dot(norm,vary_mat0),
dot(norm,vary_mat1), dot(norm,vary_mat1),
dot(norm,vary_mat2)); dot(norm,vary_mat2));
frag_data[0] = vec4(col, 0.0); frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vertex_color.aaaa; // spec frag_data[1] = vertex_color.aaaa; // spec
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
vec3 nvn = normalize(tnorm); vec3 nvn = normalize(tnorm);
frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, 0.0); frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, 0.0);
}
else
discard;
} }
...@@ -864,6 +864,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) ...@@ -864,6 +864,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
{ {
LLDrawInfo& params = **i; LLDrawInfo& params = **i;
gDeferredBumpProgram.setMinimumAlpha(params.mAlphaMaskCutoff);
LLDrawPoolBump::bindBumpMap(params, bump_channel); LLDrawPoolBump::bindBumpMap(params, bump_channel);
pushBatch(params, mask, TRUE); pushBatch(params, mask, TRUE);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment