Skip to content

Commit 6b89849

Browse files
committed
renderer/glsl: do alpha discard before texture blending
1 parent f3fe1f7 commit 6b89849

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/engine/renderer/glsl_source/lightMapping_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ void main()
6161
// compute the diffuse term
6262
vec4 diffuse = texture2D(u_DiffuseMap, texCoords);
6363

64-
// vertex blend operation like: alphaGen vertex
65-
diffuse *= var_Color;
66-
6764
if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 )
6865
{
6966
discard;
7067
return;
7168
}
7269

70+
// vertex blend operation like: alphaGen vertex
71+
diffuse *= var_Color;
72+
7373
// compute normal in world space from normalmap
7474
vec3 normal = NormalInWorldSpace(texCoords, tangentToWorldMatrix);
7575

src/engine/renderer/glsl_source/vertexLighting_DBS_entity_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ void main()
7272
// compute the diffuse term
7373
vec4 diffuse = texture2D(u_DiffuseMap, texCoords);
7474

75-
// vertex blend operation like: alphaGen vertex
76-
diffuse *= var_Color;
77-
7875
if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 )
7976
{
8077
discard;
8178
return;
8279
}
8380

81+
// vertex blend operation like: alphaGen vertex
82+
diffuse *= var_Color;
83+
8484
// compute normal in world space from normalmap
8585
vec3 normal = NormalInWorldSpace(texCoords, tangentToWorldMatrix);
8686

src/engine/renderer/glsl_source/vertexLighting_DBS_world_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ void main()
7272
// compute the diffuse term
7373
vec4 diffuse = texture2D(u_DiffuseMap, texCoords);
7474

75-
// vertex blend operation like: alphaGen vertex
76-
diffuse *= var_Color;
77-
7875
if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 )
7976
{
8077
discard;
8178
return;
8279
}
8380

81+
// vertex blend operation like: alphaGen vertex
82+
diffuse *= var_Color;
83+
8484
// compute normal in world space from normalmap
8585
vec3 normal = NormalInWorldSpace(texCoords, tangentToWorldMatrix);
8686

0 commit comments

Comments
 (0)