Jump to content
The Dark Mod Forums

Transparent stained glass


AluminumHaste

Recommended Posts

Actually turned out quite well:

 

 

I would like to be able to alpha mask the non translucent parts, like the framing so they are completely black, but I don't think you can do that AND do the post process.

Maybe Rev knows.

  • Like 2

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

I just started working on it lol. Just the blue one in the video is Bob's, I haven't looked at the other ones.

I would like to eventually have translucent versions of ALL glass textures just in case someone wants one. It's just tedious work to set up a proper normal map for the distortion, if the current one isn't that great. Sometimes it's usable, other times it doesn't really match up with the glass types in the diffuse map, and it looks....wrong to me, and I'm too pedantic to let it go as "good enough" and end up spending 2-4 hours creating a new one from scratch in photoshop.

  • Like 1

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

These are looking very cool, I can just picture playing TDM and looking inside (or outside) of a tavern window with that effect on.. would look very cool!

Link to comment
Share on other sites

I've found a way of settings the stages so that the window textures react to lights

 

 

 

Do tell?

Link to comment
Share on other sites

These are looking very cool, I can just picture playing TDM and looking inside (or outside) of a tavern window with that effect on.. would look very cool!

And using Obstortte's fake inside via .ROQ video you could effectively have load of fake inside that would like incredibly realistic.

Link to comment
Share on other sites

I think this will be the final result, I'm pretty happy with this:

 

 

@Springs, I'm still trying to figure out what I changed in the shader def that made this happen lol. Still investigating.

  • Like 2

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

Okay I'm done for the night, I was playing around with placing different light sources and recorded something I thought was cool. I had forgotten that guard was on the other side of the window and I couldn't see him until I put the candle out. Neat.

 

 

 

 

 

Do tell?

 

What I did was add a few lines. Here's the original shader def for this window:

// Author: AluminumHaste
textures/darkmod/glass/stained_glass_victorian02_2sided
{
    noshadows
    translucent
    glass
    twoSided
    forceoverlays
    sort decal
    sort nearest
    forceOpaque
    sort postProcess

    qer_editorimage textures/darkmod/glass/victorian02_ed
    
    {
        vertexProgram heatHaze.vfp
        vertexParm  0  0 , 0  // texture scrolling
        vertexParm  1  2  // magnitude of the distortion

        fragmentProgram heatHaze.vfp
        fragmentMap 0  _currentRender
        fragmentMap 1  textures/darkmod/glass/victorian02_local // the normal map for distortion
    }
    
    description "A highly ornate transluscent stained glass window"
    //--------------------------------------------------------------------------------------------------------
    {
        blend gl_dst_alpha, gl_one
        maskalpha
        cubeMap env/gen1
        // tone down the reflection a bit
        red     Parm0 * 0.2
        green   Parm1 * 0.2
        blue    Parm2 * 0.2
        texgen  reflect
    }
    // add our texture on top
    {
        blend   gl_dst_color, gl_one
        map    textures/darkmod/glass/victorian02_d
        red     Parm0
        green   Parm1
        blue    Parm2
    }
    {
        blend filter
        map textures/darkmod/glass/victorian02_d
    }

    // This is the code required for frob highlighting this texture
    {
        if ( parm11 > 0 )
            blend       gl_dst_color, gl_one
            map         _white
            rgb         0.40 * parm11
       }
    {
        if ( parm11 > 0 )
            blend       add
            map         textures/darkmod/glass/victorian02_d
            rgb         0.15 * parm11
    }
    bumpmap textures/darkmod/glass/victorian02_local
    specularmap textures/darkmod/glass/victorian02_s
    
    // TDM Ambient Method Related
    {                            
        if (global5 == 1)        
        blend add                
        map                _black        
        scale            1, 1        
        red                global2    
        green            global3    
        blue            global4    
    }                            
    {                            
        if (global5 == 2)        
        blend add                
        program    ambientEnvironment.vfp    
        vertexParm        0        1, 1, 1, 1        // UV Scales for Diffuse and Bump    
        vertexParm        1        1, 1, 1, 1    // (X,Y) UV Scale for specular        
        vertexParm        2        global2, global3, global4, 1    
                                                                
        fragmentMap        0        cubeMap env/gen1                
        fragmentMap        1        textures/darkmod/glass/victorian02_local            // Bump                
        fragmentMap        2        _black            // Diffuse            
        fragmentMap        3        textures/darkmod/glass/victorian02_s            // Specular            
    }
}

Here's the modified one:

// Author: AluminumHaste
textures/darkmod/glass/stained_glass_victorian02_2sided
{
    noshadows
    translucent
    glass
    twoSided
    forceoverlays
    sort decal
    sort nearest
    forceOpaque
    sort postProcess

    qer_editorimage textures/darkmod/glass/victorian02_ed
    
    description "A highly ornate translucent stained glass window."
    
    {
        vertexProgram heatHaze.vfp
        vertexParm  0  0 , 0  // texture scrolling
        vertexParm  1  2  // magnitude of the distortion

        fragmentProgram heatHaze.vfp
        fragmentMap 0  _currentRender
        fragmentMap 1  textures/darkmod/glass/victorian02_local // the normal map for distortion
    }
    //--------------------------------------------------------------------------------------------------------
    {
        blend gl_dst_alpha, gl_one
        maskalpha
        cubeMap env/gen1
        // tone down the reflection a lot
        red     Parm0 * 0.5
        green   Parm1 * 0.5
        blue    Parm2 * 0.5
        texgen  reflect
    }
    // add our texture on top
    {
        blend   gl_dst_color, gl_one
        map    textures/darkmod/glass/victorian02_d
        red     Parm0
        green   Parm1
        blue    Parm2
    }
    // add static image map on top
    {
        blend filter
        map textures/darkmod/glass/victorian02_d
    }

    // This is the code required for frob highlighting this texture
    {
        if ( parm11 > 0 )
            blend       gl_dst_color, gl_one
            map         _white
            rgb         0.40 * parm11
       }
    {
        if ( parm11 > 0 )
            blend       add
            map         textures/darkmod/glass/victorian02_d
            rgb         0.15 * parm11
    }
    diffusemap textures/darkmod/glass/victorian02_d
    {
        blend    add
        map        textures/darkmod/glass/victorian02_d
        rgb     0.05
    }    
    specularmap     textures/darkmod/glass/victorian02_s
    
    // This is the code required for frob highlighting this texture
    {
        if ( parm11 > 0 )
        blend    gl_dst_color, gl_one
        map        _white
        rgb        0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend    add
        map        textures/darkmod/glass/victorian02_d
        rgb        0.15 * parm11
    }

    // TDM Ambient Method Related
    {                            
        if (global5 == 1)        
        blend add                
        map                textures/darkmod/glass/victorian02_d        
        scale            1, 1        
        red                global2    
        green            global3    
        blue            global4    
    }                            
    {                            
        if (global5 == 2)        
        blend add                
        program    ambientEnvironment.vfp    
        vertexParm        0        1, 1, 1, 1    // UV Scales for Diffuse and Bump    
        vertexParm        1        1, 1, 1, 1    // (X,Y) UV Scale for specular        
        vertexParm        2        global2, global3, global4, 1    

        fragmentMap        0        cubeMap env/gen1                
        fragmentMap        1        textures/darkmod/glass/victorian02_local            // Bump                
        fragmentMap        2        textures/darkmod/glass/victorian02_d            // Diffuse            
        fragmentMap        3        textures/darkmod/glass/victorian02_s            // Specular            
    }
}

I think it was the blend add stage that made the difference.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

That blend add should just make the texture very slightly self lit. But oddly, you define a diffusemap that is a regular texture...in my experience that is incompatible with transparency. Weird.

Link to comment
Share on other sites

Yeah pretty much. I think Rev was working on something where shadows would show up on the backs of leaves, that might work for this too. But that was a long time ago, not sure where that stands.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

That blend add should just make the texture very slightly self lit. But oddly, you define a diffusemap that is a regular texture...in my experience that is incompatible with transparency. Weird.

 

It's probably being controlled by the "translucent" global keyword at the top of the material decl. "Translucent" makes ordinary diffusemaps draw in a checkerboard pattern: one pixel on, one pixel off, which gives exactly 50% transparency while letting the "on" pixels receive lighting as normal. On top of that we have various blends which seem to be overcoming the 50%-transparent-only limitation of "translucent" by brightening and darkening both the "on" and "off" pixels by adding further layers of colour using "blend add" and "filter".

 

The overall effect is great! And it looks like we can overcome the "no lit transparency" rules that're common to lots of engines, not just ours. Recently we've seen Arcturus's lit water ripples, then that bottle that Obsttorte demo'd recently, both of which used blank bump maps and/or specular maps to add reflections from nearby lights. Now this stained glass of AH's that takes it a step further and behaves right with lights either side.... exciting possibilities :)

  • Like 2
Link to comment
Share on other sites

That blend add should just make the texture very slightly self lit. But oddly, you define a diffusemap that is a regular texture...in my experience that is incompatible with transparency. Weird.

Not really, it just becomes 50% transparent. But from the shader I guess the opaque parts only look opaque, but aren't really.

 

Good work otherwise.

 

Btw.: The block containing if(global5 == 2) can be removed

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

 

Is that for the old ambient method?

 

Yes, that's for the old "Enhanced Ambient". As I recall, this is no longer used and the dedicated Ambient.vfp is now in place.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

One thing I was hoping you could take a look at steve, when using DDS files in any of the stages, I get this weird staggered effect where it looks like one of the diffuse stages is moving over a bit, you can see in the large Lion image with the white arrows.

 

The smaller Victorian window that I've already converted all DDS to TGA, doesn't have this issue.

 

post-529-0-97847200-1433983532_thumb.jpg

 

 

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

 

I've been converting some of the windows (Not sure if they are yours) into transparent ones, but they don't always get used.

Video:

 

 

I do create the bump map by hand so different types of glass get different amounts/types of distortion, it's just slow tedious work and I'm not all that great at it.

Au contraire my friend, these are pretty great!

Link to comment
Share on other sites

One thing I was hoping you could take a look at steve, when using DDS files in any of the stages, I get this weird staggered effect where it looks like one of the diffuse stages is moving over a bit, you can see in the large Lion image with the white arrows.

 

The smaller Victorian window that I've already converted all DDS to TGA, doesn't have this issue.

 

attachicon.gifdarkmod_2015-06-10_20.35.32.jpg

It's the compressed (dds) normal map being used in the heat_haze.vfp fragment program that's causing the problem. The lit stage of the shader gets drawn before the distortion gets applied, i.e. it gets distorted too. For some reason, heat_haze.vfp shifts everything to the left when given the dds version of the normal map, so your lit shader stage is out of line with the blended colour layers. You can fix it by using the tga just for the heat_haze effect and using dds for the other stages.

 

One other thing I noticed: that lion glass image is not a power-of-two, it's 1024x768. The engine sometimes makes a right mess of rescaling images, but we seem to be getting away with it with this one. But there's another difference there between DDS and TGA. The engine rescales the TGA version to 1024x512 before uploading it to the GPU, but DDS images are not touched by the engine so the gpu is actually using a 1024x768 texture and mis-sized mipmaps when you use the DDS version.

Link to comment
Share on other sites

Wonderful! Would be coolif we could convert the old materials and upgrade maps - but it's probably just a dream.

 

One thing that might work for the "black parts" of the glass is to add another stage with a diffusemap which only has these parts as black. OTOH, the "blackframes" between the glass panes are lead, so they shouldn't be black, just very dark.

 

https://en.wikipedia.org/wiki/Leadlight

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...