[FTEQW] Dynamic lights on transparent objects
Moderator: InsideQC Admins
2 posts
• Page 1 of 1
[FTEQW] Dynamic lights on transparent objects
Hi guys, I'm creating a tree branch shader with transparent leaves.
I've used this guide (which it's overcopied all over the web) for the script creation. Leaves are cool, transparent and look fair.
The problem is tied to dynamic lights in FTEQW(trough dynamiclight_add function added in code, not with regular "light" entities in map editor). When lit by dynamic lights, object with above shader, rimain always fullbright.
I removed also glsl link but it shows a tremendous black silhouette around non-transparent edges, and still it's fullbright
Have someone figured out how to solve this issue?
Thanks a bunch!
- Code: Select all
textures/world/tree1leaves1
{
program spike_rtlight
cull none
{
map textures/world/tree1leaves1.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphaFunc GT0
depthWrite
rgbGen identity
}
{
map $lightmap
rgbGen identity
blendFunc GL_DST_COLOR GL_ZERO
depthFunc equal
}
}
I've used this guide (which it's overcopied all over the web) for the script creation. Leaves are cool, transparent and look fair.
The problem is tied to dynamic lights in FTEQW(trough dynamiclight_add function added in code, not with regular "light" entities in map editor). When lit by dynamic lights, object with above shader, rimain always fullbright.
I removed also glsl link but it shows a tremendous black silhouette around non-transparent edges, and still it's fullbright
Have someone figured out how to solve this issue?
Thanks a bunch!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: [FTEQW] Dynamic lights on transparent objects
SOLVED! Thanks (obviously!) to a very interesting chat with Spike, he suggest me to look at discard keyword in glsl when alpha value is 0.
So I opened glsl file I was using (defaulwall.glsl generated by issueing in engine the r_dumpshaders command) and adding, at line 157, after gl_FragColor.rgb *= lightmaps.rgb;
Than, the shader looks like
Now alpha textures are "perforated" correcly and lit also by dynamic lights! Cool!
Now, I'll try to more things
NOTE TO ADMINISTRATORS: could you please add edit post option to users? Because I can't re-tag 1st post as [SOLVED]
So I opened glsl file I was using (defaulwall.glsl generated by issueing in engine the r_dumpshaders command) and adding, at line 157, after gl_FragColor.rgb *= lightmaps.rgb;
- Code: Select all
#ifdef ALPHAMASKED
//toneddu2000: IMPORTANT!!As Spike (thankyou thankyou thankyou!) teached me, put this to discard non-masked elements, for alpha masked transparent textures
if (gl_FragColor.a < 0.1){
discard; // yes: discard this fragment
}
#endif
Than, the shader looks like
- Code: Select all
textures/world/tree1leaves1
{
program spike_defaultwall#ALPHAMASKED
diffusemap textures/world/tree1leaves1.tga
{
map $lightmap
}
}
Now alpha textures are "perforated" correcly and lit also by dynamic lights! Cool!
Now, I'll try to more things
- Adding the discard keyword also in rtlights.glsl (for now I couldn't make it work)
- Making shadow maps discard alpha value too (I can't figure out how to override shadow pass. Spike told me that 2nd pass is the depthonly one, which generates shadcow, but I can't understand how to "intercept" it).
NOTE TO ADMINISTRATORS: could you please add edit post option to users? Because I can't re-tag 1st post as [SOLVED]
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest