Jump to content
The Dark Mod Forums

Vary amount of transparency: material or shaderParm howto..?


Bikerdude

Recommended Posts

So trying to add some specular -

translucent/pumpkin

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin
	
    specularmap	models/darkmod/props/textures/pumpkin_s

    description "translucent paper for lamps"

    {
    blend bumpmap
    map models/darkmod/props/textures/pumpkin_local
    rgb 1.0
    vertexcolor
    }

    {
    blend diffusemap
    map _white
    red 0.5
    green 0.2
    blue 0.1
    }

    {
    blend bumpmap
    map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
    rgb 1.0
    inversevertexcolor
    }

    {
    blend diffusemap
    map _white
    red 0.5
    green 0.2
    blue 0.1
    }

    {
        vertexProgram colorProcess.vfp
        vertexParm  0  0 , 0  	// texture scrolling
        vertexParm  1  2  		// magnitude of the distortion

        fragmentProgram colorProcess.vfp
        fragmentMap 0  _currentRender
        fragmentMap 1  models/darkmod/props/textures/pumpkin_local
        fragmentMap 2 _currentDepth
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin
        alpha 0.8
        rgb 1.0
    }    

    {
     blend bumpmap
     map models/darkmod/props/textures/pumpkin_local
     }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}
Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

So trying to add some specular -

translucent/pumpkin

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin
	
 

    description "translucent paper for lamps"

    {
    blend bumpmap
    map models/darkmod/props/textures/pumpkin_local
    rgb 1.0
    vertexcolor
    }

    {
    blend diffusemap
    map _white
    red 0.5
    green 0.2
    blue 0.1
    }

{

Blend specularmap

Map models/darkmod/props/textures/pumpkin_s

RGB 0.5

}
    {
    blend bumpmap
    map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
    rgb 1.0
    inversevertexcolor
    }

    {
    blend diffusemap
    map _white
    red 0.5
    green 0.2
    blue 0.1
    }

{
  Blend specularmap
 Map models/darkmod/props/textures/pumpkin_s
RGB 0.5
}

    {
        vertexProgram colorProcess.vfp
        vertexParm  0  0 , 0  	// texture scrolling
        vertexParm  1  2  		// magnitude of the distortion

        fragmentProgram HeathazeWithMaskAndDepth.vfp
        fragmentMap 0  _currentRender
        fragmentMap 1  _flat
        fragmentMap 2 _currentDepth
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin
        alpha 0.8
        rgb 1.0
    }    

    {
     blend bumpmap
     map models/darkmod/props/textures/pumpkin_local
     }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}
Edited your example. At the ride park with the family so I didn't have time to check the spelling of the vfp but that's how it should work.

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

Edited your example. At the ride park with the family so I didn't have time to check the spelling of the vfp but that's how it should work.

Didnt appear to work and causes a nasty flicker as you move around the lampion's

translucent/pumpkin

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin
	
    description "translucent paper for lamps"

    {
	blend bumpmap
	map models/darkmod/props/textures/pumpkin_local
	rgb 1.0
	vertexcolor
    }

    {
	blend diffusemap
	map _white
	red 0.5
	green 0.2
	blue 0.1
    }

    {
	Blend 	specularmap
	Map 	models/darkmod/props/textures/pumpkin_s
	rgb 0.5
    }
	
    {
	blend bumpmap
	map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
	rgb 1.0
	inversevertexcolor
    }

    {
	blend diffusemap
	map _white
	red 0.5
	green 0.2
	blue 0.1
    }

    {
	Blend 	specularmap
	Map 	models/darkmod/props/textures/pumpkin_s
	rgb 0.5
    }

    {
        vertexProgram colorProcess.vfp
        vertexParm  0  0 , 0  	// texture scrolling
        vertexParm  1  2  		// magnitude of the distortion

        fragmentProgram HeathazeWithMaskAndDepth.vfp
        fragmentMap 0  _currentRender
        fragmentMap 1  _flat
        fragmentMap 2 _currentDepth
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin
        alpha 0.8
        rgb 1.0
    }    

    {
	blend bumpmap
	map models/darkmod/props/textures/pumpkin_local
    }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}
Link to comment
Share on other sites

I tried to reduce the shader complexity and make an even simpler version but both the colorprocess vfp and my own

variant had the problem of "toggling the diffuse stage off" in a binary fashion when not centered in view and at the boundary of the light volume.

 

Using the heathaze shader with the fragmentMap 1 set to _flat fixed the problem.

 

Probably needs to translate coordinates to screen-space perspective as part of the solution to prevent that.

 

Still crackin' away at optimization but I don't know if it's worth it.

 

The solution works and these operations are fairly light on the GPU anyway.

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

If you don't add the transparency effect, the behavior works in such a way that lighting in front obscures back lighting

proportional to how much hits each side.

 

With the transparency there, you get shading from all sides as expected, though it's probably wasteful to do both effects here.

You could probably get away with just one "lit stages group" but the translucency effect does finally solve that longstanding complaint

about interior caustics for transparent objects like flasks.

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

This is as small as I can get the VFP program without causing the diffuse cutoff glitch:

 

 

 
!!ARBvp1.0 OPTION ARB_position_invariant ;

# input:
#
# texcoord[0] TEX0    texcoords
#
# output:
#
# texture 0 is _currentRender
#
# texCoord[2] is the copied deform magnitude

TEMP    R0, R1;

MUL        result.texcoord[2], R1, 1.0;

END

#======================================================================

!!ARBfp1.0
OPTION ARB_precision_hint_fastest;

# texture 0 is _currentRender
#
# env[0] is the 1.0 to _currentRender conversion
# env[1] is the fragment.position to 0.0 - 1.0 conversion

TEMP    R0;

# calculate the screen texcoord in the 0.0 to 1.0 range
MUL        R0, fragment.position, program.env[1];

# scale by the screen non-power-of-two-adjust
MUL        R0, R0, program.env[0];

# load the screen render
TEX        result.color.xyz, R0, texture[0], 2D;

END
 

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

Yeah, I committee transparency_hack.vfp to SVN last night. You can rename it anything you like then make sure you have this block:

{
VertexProgram transparency_hack.vfp
FragmentProgram transparency_hack.vfp
FragmentMap 0 _currentRender
}

Instead of heathaze in your material def.

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

Ok I think I screwed up somewhere as the textures are now black in-game.

 

transparency_hack.vfp

 
!!ARBvp1.0 OPTION ARB_position_invariant ;

# input:
#
# texcoord[0] TEX0    texcoords
#
# output:
#
# texture 0 is _currentRender
#
# texCoord[2] is the copied deform magnitude

TEMP    R0, R1;

MUL        result.texcoord[2], R1, 1.0;

END

#======================================================================

!!ARBfp1.0
OPTION ARB_precision_hint_fastest;

# texture 0 is _currentRender
#
# env[0] is the 1.0 to _currentRender conversion
# env[1] is the fragment.position to 0.0 - 1.0 conversion

TEMP    R0;

# calculate the screen texcoord in the 0.0 to 1.0 range
MUL        R0, fragment.position, program.env[1];

# scale by the screen non-power-of-two-adjust
MUL        R0, R0, program.env[0];

# load the screen render
TEX        result.color.xyz, R0, texture[0], 2D;

END

bkd_translucent_test.mtr


translucent/pumpkin

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin
	
    description "translucent paper for lamps"

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
		rgb 1.0
		vertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }
	
    {
		blend bumpmap
		map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
		rgb 1.0
		inversevertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }

	{
		VertexProgram transparency_hack.vfp
		FragmentProgram transparency_hack.vfp
		FragmantMap 0 _currentRender
	}

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin
        alpha 0.8
        rgb 1.0
    }    

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
    }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}

translucent/pumpkin_green

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin_green
	
    description "translucent paper for lamps"

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
		rgb 1.0
		vertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }
	
    {
		blend bumpmap
		map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
		rgb 1.0
		inversevertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }

	{
		VertexProgram transparency_hack.vfp
		FragmentProgram transparency_hack.vfp
		FragmantMap 0 _currentRender
	}

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin_green
        alpha 0.8
        rgb 1.0
    }    

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
    }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}

translucent/pumpkin_red
{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin_red	
    description "translucent paper for lamps"

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
		rgb 1.0
		vertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }

    {
		blend bumpmap
		map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
		rgb 1.0
		inversevertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }

	{
		VertexProgram transparency_hack.vfp
		FragmentProgram transparency_hack.vfp
		FragmantMap 0 _currentRender
	}

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin_red        
		alpha 0.8
        rgb 1.0
    }    

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
    }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}

translucent/pumpkin_blue
{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin_blue	
    description "translucent paper for lamps"

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
		rgb 1.0
		vertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }

    {
		blend bumpmap
		map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
		rgb 1.0
		inversevertexcolor
    }

    {
		blend diffusemap
		map _white
		red 0.5
		green 0.2
		blue 0.1
    }

	{
		VertexProgram transparency_hack.vfp
		FragmentProgram transparency_hack.vfp
		FragmantMap 0 _currentRender
	}

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin_blue        
		alpha 0.8
        rgb 1.0
    }    

    {
		blend bumpmap
		map models/darkmod/props/textures/pumpkin_local
    }

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}
Link to comment
Share on other sites

Change: fragmantMap to fragmentMap.

 

I was the one with a misspell this time :)

 

Fixed material:

 

 

 

 

 

 
translucent/pumpkin

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin
    
    description "translucent paper for lamps"

    {
        blend bumpmap
        map models/darkmod/props/textures/pumpkin_local
        rgb 1.0
        vertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }
    
    {
        blend bumpmap
        map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
        rgb 1.0
        inversevertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }

    {
        vertexProgram transparency_hack.vfp
        fragmentProgram transparency_hack.vfp
        fragmentMap 0 _currentRender
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin
        alpha 0.8
        rgb 1.0
    }    

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}

translucent/pumpkin_green

{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin_green
    
    description "translucent paper for lamps"

    {
        blend bumpmap
        map models/darkmod/props/textures/pumpkin_local
        rgb 1.0
        vertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }
    
    {
        blend bumpmap
        map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
        rgb 1.0
        inversevertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }

    {
        vertexProgram transparency_hack.vfp
        fragmentProgram transparency_hack.vfp
        fragmentMap 0 _currentRender
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin_green
        alpha 0.8
        rgb 1.0
    }    

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}

translucent/pumpkin_red
{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin_red    
    description "translucent paper for lamps"

    {
        blend bumpmap
        map models/darkmod/props/textures/pumpkin_local
        rgb 1.0
        vertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }

    {
        blend bumpmap
        map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
        rgb 1.0
        inversevertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }

    {
        vertexProgram transparency_hack.vfp
        fragmentProgram transparency_hack.vfp
        fragmentMap 0 _currentRender
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin_red        
        alpha 0.8
        rgb 1.0
    }    

    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}

translucent/pumpkin_blue
{
    noshadows
    twoSided
    translucent
    forceoverlays
    sort decal
    forceOpaque

    qer_editorimage models/darkmod/props/textures/pumpkin_blue    
    description "translucent paper for lamps"

    {
        blend bumpmap
        map models/darkmod/props/textures/pumpkin_local
        rgb 1.0
        vertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }

    {
        blend bumpmap
        map scale(models/darkmod/props/textures/pumpkin_local, 1, 1, 0, 1)
        rgb 1.0
        inversevertexcolor
    }

    {
        blend diffusemap
        map _white
        red 0.5
        green 0.2
        blue 0.1
    }

    {
        vertexProgram transparency_hack.vfp
        fragmentProgram transparency_hack.vfp
        fragmentMap 0 _currentRender
    }

    //--------------------------------------------------------------------------------------------------------

    // add our texture on top
    {
        blend blend
        maskalpha
        map    models/darkmod/props/textures/pumpkin_blue        
        alpha 0.8
        rgb 1.0
    }    


    // TDM Ambient Method Related

    {                            
        if (global5 == 1)        
        blend add                
        map              _black        
        scale            1, 1        
        red              global2    
        green            global3    
        blue             global4    
    }                            
}
 

 

 

 

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

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

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 0 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 3 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
×
×
  • Create New...