Glittering metal


(Donpedro) #1

Can anybody tell me how can i create glittering things? Thx :x


(=PoW= Kernel 2.6.5) #2

You’ll definatly want to look over the shader manual.

Also take a look at the shader scripts for the x-lab metals.


(Donpedro) #3

I can use shaders, i created this, but looks like… Not like a glittering metal. The mistake maybe in blend.

textures/shaderr/metal
{
	qer_editorimage textures/metals_sd/wall_b.jpg
	{
		map textures/metal_misc/ametal_m02.jpg
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity

	}
	{
		map textures/effects/envmap_slate.tga
		blendFunc GL_ONE GL_ONE 
		tcGen environment
		tcMod Scale 0.2 0.2  
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
	
}


(Donpedro) #4

here is the result:
http://www.et-section.atw.hu/shad.htm


(Loffy) #5

Hallo!

I made some laboratory doors, here:
http://www.etmaps-test.de/etmaps/prefabs/laboratory_doors.rar
But I cannot remember if they are shiny. Perhaps you can take a look?

Good luck!

//L.


(Donpedro) #6

loffy, where’s the glittering thing on this map? ^^


(Loffy) #7

If the doors are n’t glittering, I cannot help you there. I thought they were shiny and that I used a special shader on them, but I am absent minded sometimes.

Are there any maps out there today that have this glittering effect that you are after?

Is it a shiny metal glitter, or is it a particle glitter effects that you want?

//L.


(Donpedro) #8

for example, on the gold model the gold bars are glittering.


(nUllSkillZ) #9

Take a look at the latest “Helms Deep” map.


(=PoW= Kernel 2.6.5) #10

Looking at the x_metal shader I noticed there is no blend in the first part:


textures/xlab_wall/xmetal_m02a
{
	surfaceparm metalsteps
	{
		map textures/effects/tinfx.tga
		rgbGen identity
		tcGen environment
	}
	{
		map textures/xlab_wall/xmetal_m02a.tga
		blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
		rgbGen identity
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
}



(CptnTriscuit) #11

The ‘glittering’ effect I think your looking for it accomplished by stacking an semi-transparent texture map on top of some other texture map to produce the illusion of reflection.

For this kind of effect, you’ll first need a texture map to serve as the reflection. There are several to choose from in the ‘texture/effects’ directory, but you may wish to make your own if your trying to achieve a specific effect. This texture map can be either JPEG (.jpg) or TARGA (.tga).

If you want a non-specific reflection effect a small texture map distorted with tcGen environment in it’s shader stage will be your best bet. The shader you posted already contains this stage, though I believe it needs to be the first stage, not the second.


   {
      map textures/effects/envmap_slate.tga
      blendFunc GL_ONE GL_ONE
      tcGen environment
      tcMod Scale 0.2 0.2 
   } 

The second texture map will be applied on top of the ‘reflection’ texture map. This second texture map needs to be a targa, because the targa’s alpha channel is what is used to produce transparency. (There are ways to create similar effects using only jpegs and clever blending, but for this method, use a targa)

The engine uses the gray-scale alpha channel to determine the transparency of the other three channels (RGB). Black indicating 100% transparency (invisible) all the way through the grays to white, indicating 0% transparency (solid). The more transparent this texture map. the more of your first ‘reflection’ texture map will show through. Thus, you can control how ‘reflective’ or ‘glittery’ you want your finished texture appear, by manipulating the alpha channel on your targa.

As others have suggested, check out the xlabwall textures and shader. I can’t quote the exact one off the top of my head, but find the shiny metal and copy its shader into your own shader script and swap out the xlab texture maps with your own. Play around with the alpha channels and come up with a few variations, then test them in game. Once you get a feel for it, then write your own shader specific to what you needs are.

Sorry, I probably haven’t explained this very well - but, additional questions are welcome!


(Jecoliah) #12

Here is the shader your looking for…

textures/(your texture folder)/(your texture)
{
surfaceparm metalsteps
{
map textures/effects/tinfx.tga
rgbGen identity
tcGen environment
}
{
map textures/(your texture folder)/(your texture).tga
blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
rgbGen identity
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
}

Your custom Texture needs to be in .TGA format and it needs an alpha channel.

Jec


(Donpedro) #13

I’m wondering how helpful are you mates, thanks a lot, im pleased. Thanks again for the help, the solution was the alpha channel in TGA. I feel, i can learn here. Thanks mates :wink: