Jump to content

"Stained Glass" Shader


Go to solution Solved by MoonDog,

Recommended Posts

Posted

Seems I've tried a dozen different variations to try and make a colored .tga design look like a stained glass window.

 

I've tried mapping in a Tcgen environment, mapping in a reflective glass. 

 

Even tried making the colored texture transparent and putting a pane of base glass behind it.

 

The best I've come up with is a surface light shader but then it just looks like a glowing wall rather than a window with light coming from behind it. Any ideas?

 

 

 

Best iteration so far:

 

 

 

textures/the_enclave/stglass
{
q3map_material Glass
surfaceparm nonopaque
surfaceparm trans
surfaceparm alphashadow
cull twosided
qer_trans 1.0
    {
        map textures/the_enclave/stglass
        alphaFunc GE128
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        depthWrite
    }
    { 
        map $lightmap 
        rgbGen identity 
        blendFunc GL_DST_COLOR GL_ZERO 
        depthFunc equal 
    }
    {
        map textures/the_enclave/stglass
        blendFunc GL_ONE GL_ONE
rgbGen identity
glow
    }
}
 
shot0071_zps6b011696.jpg

 

Just looks like a glowing wall. Is this the best I can hope for with the engine?

 

  • Solution
Posted
q3logo.jpgsurfaceparm lightfilter

Causes the Q3Map2 light stage to use the texture's RGB and alpha channels to generate colored alpha shadows in the lightmap. For example, this can be used to create the colored light effect cast by stained glass windows. This can be used with surfaceparm alphashadow.

Posted

q3logo.jpgsurfaceparm lightfilter

Causes the Q3Map2 light stage to use the texture's RGB and alpha channels to generate colored alpha shadows in the lightmap. For example, this can be used to create the colored light effect cast by stained glass windows. This can be used with surfaceparm alphashadow.

 

 

So far as I can tell that didn't change anything. I even removed alphashadow to see if it was conflicted at all.

 

shot0072_zpsbe1dcb57.jpg

 

Current .shader settings

 

 

textures/the_enclave/stglass

{
q3map_material Glass
surfaceparm nonopaque
surfaceparm trans
surfaceparm lightfilter
cull twosided
qer_trans 1.0
    {
        map textures/the_enclave/stglass
        alphaFunc GE128
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        depthWrite
    }
    { 
        map $lightmap 
        rgbGen identity 
        blendFunc GL_DST_COLOR GL_ZERO 
        depthFunc equal 
    }
    {
        map textures/the_enclave/stglass
        blendFunc GL_ONE GL_ONE
rgbGen identity
glow
    }
}

Posted

Much like a shadow casting grate, you'll need a lightsource behind the material pointing in the desired direction.

 

Is your source material setup properly for transparency? I imagine it'd have to be for lightFilter. I've never used lightFilter tbh.

RebelChum likes this
Posted

Thanks for all your help, moondog. I think it's fine the way it is. I coupled it with some nice entity lights and decals and it looks fairly convincing.

 

Appreciate your help!

Posted

No problem! I wouldn't mind seeing a shot or two of your results. I've never used lightFilter, curious to see how it turns out.

Posted

No problem! I wouldn't mind seeing a shot or two of your results. I've never used lightFilter, curious to see how it turns out.

 

shot0073_zps5bcb4cc9.jpg

 

Not sure if I should keep the light ray in there.

RAILBACK likes this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...