Skip to content

Commit de8ae0b

Browse files
committed
game_dir: glsl: implemented discarding non-opaque texels during light pass on transparent meshes
1 parent ee4a132 commit de8ae0b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

game_dir/glsl/forward/light_bmodel_fp.glsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ void main()
202202
#endif
203203
#endif
204204

205+
#if !defined( HAS_TRANSPARENCY )
206+
// skipping lighting for fragments that aren't opaque
207+
if( albedo.a < 0.999 )
208+
discard;
209+
#endif
210+
205211
vec3 light = u_LightDiffuse * DLIGHT_SCALE; // light color
206212
float shadow = 1.0;
207213
float NdotL = saturate( dot( N, L ));

game_dir/glsl/forward/light_studio_fp.glsl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ void main( void )
163163
}
164164
#endif
165165
#endif
166+
167+
#if !defined( HAS_TRANSPARENCY )
168+
// skipping lighting for fragments that aren't opaque
169+
if( diffuse.a < 0.999 )
170+
discard;
171+
#endif
172+
166173
if (shadow <= 0.0)
167174
discard; // fast reject
168175

0 commit comments

Comments
 (0)