Jump to content
The Dark Mod Forums

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


Bikerdude

Recommended Posts

I am trying to make some chinese lanterns -

  • I have already created some two-sisded textures from existing paint textures,
  • I added the transparent arg to the material def, but it appears to be 100%.
  • So then I wehn to the wiki and found 'shaderParm3 and applied that to the FS model, but it dosent work.

So, can I vary the mount of transparency say by 50%? or is the shaderParm rout the right and I am just doing it wrong..?

 

ta.

Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

AFAIK transparency will make anything with the pink colour 100% transparent, it's binary 100% opaque or 100% transparent.

 

Or, take the chain link fence texture in Doom 3 and see how it was done. It sounds like basically the same thing, you want parts to the transparent but opaque in others.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

The alpha keyword will set the percentage of transparency.

 

LOD entities use shaderParm3 to dynamically alter this but use alphatest to cut-off parts of the LOD texture:

 

http://wiki.thedarkmod.com/index.php?title=Alpha-fading

 

http://wiki.thedarkmod.com/index.php?title=List_of_shaderParm_variables

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

The alpha keyword will set the percentage of transparency.

So tried gave that a go, no effect -

//paper texture for chinese lanterns - bikerdude

textures/darkmod/paint_paper/transparent/chinese_lantern_fancy_red
{

    surftype15
    description "cloth"
	
    twosided

    qer_editorimage textures/darkmod/paint_paper/wallpaper_fancy_red_ed
    {
    blend diffusemap
        map    		textures/darkmod/paint_paper/wallpaper_fancy_red
    alphatest 0.8
    }
    bumpmap         textures/darkmod/paint_paper/wallpaper_fancy_local

    {
        if ( parm11 > 0 )
        blend       gl_dst_color, gl_one
        map         _white
        rgb         0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend       add
        map         textures/darkmod/paint_paper/wallpaper_fancy_red
        rgb         0.15 * parm11
    }

	// TDM Ambient Method Related 
	{							
		if (global5 == 1)		
		blend add				
		map				textures/darkmod/paint_paper/wallpaper_fancy_red		
		scale			1, 1		
		red				global2	
		green			global3	
		blue			global4	
	}							
}
Link to comment
Share on other sites

So -

  • changed 'alphatest 0.8' to 'alpha 0.8' no change,
  • added the keyword transparency below twosided, and the textures apears tranparent but black
  • reduced the alpha value, no change, texture still black.

 

Is is possible its not working because the texture in question dont have an alpha channel..? Scratch that I just check in Gimp at there is an alpha channel.

Link to comment
Share on other sites

I spoke to soon, the alpha amount dosen't seem to have any effect on amount of transparency -

textures/darkmod/paint_paper/transparent/chinese_lantern_fancy_red
{

    surftype15
    description "cloth"
	
    twosided
    translucent

    qer_editorimage textures/darkmod/paint_paper/wallpaper_fancy_red_ed
    {
    blend diffusemap
        map    		textures/darkmod/paint_paper/wallpaper_fancy_red
    alpha 0.35
    }
    bumpmap         textures/darkmod/paint_paper/wallpaper_fancy_local

    {
        if ( parm11 > 0 )
        blend       gl_dst_color, gl_one
        map         _white
        rgb         0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend       add
        map         textures/darkmod/paint_paper/wallpaper_fancy_red
        rgb         0.15 * parm11
    }

	// TDM Ambient Method Related 
	{							
		if (global5 == 1)		
		blend add				
		map				textures/darkmod/paint_paper/wallpaper_fancy_red		
		scale			1, 1		
		red				global2	
		green			global3	
		blue			global4	
	}							
}
Link to comment
Share on other sites

Ack!

 

I keep forgetting that alpha (not alphatest) material stages cannot be lit.

(Unlit meaning blend blend or blend add, cannot use blend diffusemap)

 

Under normal circumstances, you'd make a material like a glass shader but if you want the material to look like

fabric, you need to use the technique here:

 

http://forums.thedarkmod.com/topic/11515-real-translucency-anyone/

 

1) Export the Model

2) Vertex paint it with 50% weight everywhere

3) Texture is with a material like:

 
translucent/example
{

    // one set comprised of a normal map and diffuse map utilizing the vertexcolor keyword

    {
        blend    bumpmap
        map    normalmap.tga
        vertexcolor
    }
    {
        blend    diffusemap
        map    diffusemap.tga
        vertexcolor
    }

    // a second set using the same images with the inversevertexcolor keyword

    // the scale function here is "inverting" the normal map so that it catches light from the opposite side.

    {
        blend    bumpmap
        map    scale(normalmap.tga, 1, 1, 0, 1)
        inversevertexcolor
    }
    {
        blend    diffusemap
        map    diffusemap.tga
        inversevertexcolor
    }
 

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

Strange. It's just a YouTube video. Google "real translucency Doom 3" and you should find it amongst Rich_is_Bored's videos.

 

That said, there's no tutorial for the creation part. You need to know how to vertex paint in a modeling application.

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

With a better understanding of fragment programs it occurs to me that it should be possible to assign vertex colors in a vfp. That's huge because it means you can make use of this effect on everything, not just models. I'll investigate this in the coming days and confirm.

Thanks Rich!

Link to comment
Share on other sites

instead of alpha use rgb parm3

 

Now you can alter the level of transparancy using the spawnarg shaderParm3

 

Note that you don't have the full bandwidth between invisible and opaque, the material is always translucent.

 

For more control you really need a shader program

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

Just wanted to report back. The following shader should assign a grey value to every vertex...

 

 

!!ARBvp1.0
OPTION ARB_position_invariant;

MOV result.color, {0.5, 0.5, 0.5, 1.0};

END

 

However, in TDM for reasons that escape me the vertex colors remain black. I've checked the console for errors and the shader compiles with no problem.

Link to comment
Share on other sites

I don't think you can alter a lit material that way?

 

You probably need to integrate this into a copy of our entire light vfp (probably where it gathers the vertex color)

then call that whole shebang from the material def?

 

Does it work with an unlit material?

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

That was directed at Rich. If it's anything other than model that might tell us that the other formats do not respect the vertex color attribute

for some reason. I can't see how that would be the case but perhaps there's a driver bug.

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

    • 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
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
×
×
  • Create New...