Bug fix #33639
Material Texture blend modes Screen, Overlay and Multiply didn't respect the alpha for textures... an error I could trace back to 2004 even. Obviously the fix should be done, but it might change the appearance of renders somewhat. Will keep an eye open if this is worth ugly version-patching. Now: image textures with alpha, will only apply the blend modes respecting the alpha values.
This commit is contained in:
@@ -811,7 +811,7 @@ void mtex_rgb_mul(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 inc
|
||||
float facm;
|
||||
|
||||
fact *= facg;
|
||||
facm = 1.0-facg;
|
||||
facm = 1.0-fact;
|
||||
|
||||
incol = (facm + fact*texcol)*outcol;
|
||||
}
|
||||
@@ -821,7 +821,7 @@ void mtex_rgb_screen(vec3 outcol, vec3 texcol, float fact, float facg, out vec3
|
||||
float facm;
|
||||
|
||||
fact *= facg;
|
||||
facm = 1.0-facg;
|
||||
facm = 1.0-fact;
|
||||
|
||||
incol = vec3(1.0) - (vec3(facm) + fact*(vec3(1.0) - texcol))*(vec3(1.0) - outcol);
|
||||
}
|
||||
@@ -831,7 +831,7 @@ void mtex_rgb_overlay(vec3 outcol, vec3 texcol, float fact, float facg, out vec3
|
||||
float facm;
|
||||
|
||||
fact *= facg;
|
||||
facm = 1.0-facg;
|
||||
facm = 1.0-fact;
|
||||
|
||||
if(outcol.r < 0.5)
|
||||
incol.r = outcol.r*(facm + 2.0*fact*texcol.r);
|
||||
|
@@ -1339,7 +1339,7 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
|
||||
|
||||
case MTEX_MUL:
|
||||
fact*= facg;
|
||||
facm= 1.0f-facg;
|
||||
facm= 1.0f-fact;
|
||||
in[0]= (facm+fact*tex[0])*out[0];
|
||||
in[1]= (facm+fact*tex[1])*out[1];
|
||||
in[2]= (facm+fact*tex[2])*out[2];
|
||||
@@ -1347,7 +1347,7 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
|
||||
|
||||
case MTEX_SCREEN:
|
||||
fact*= facg;
|
||||
facm= 1.0f-facg;
|
||||
facm= 1.0f-fact;
|
||||
in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]);
|
||||
in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]);
|
||||
in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]);
|
||||
@@ -1355,7 +1355,7 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
|
||||
|
||||
case MTEX_OVERLAY:
|
||||
fact*= facg;
|
||||
facm= 1.0f-facg;
|
||||
facm= 1.0f-fact;
|
||||
|
||||
if (out[0] < 0.5f)
|
||||
in[0] = out[0] * (facm + 2.0f*fact*tex[0]);
|
||||
|
Reference in New Issue
Block a user