Shader - animated texture...


(PleaseMYOB) #1

I really hate asking, since I like to learn on my own… :banghead:

I’m trying to animate a texture for SOF2… What am I doing wrong?

textures/pleasemyob/animated_test
{
q3map_material computer
qer_editorimage textures/pleasemyob/qe_animated
{
map $lightmap
}
{
animMap 0.5 textures/pleasemyob/animated1 textures/pleasemyob/animated2
blendFunc GL_DST_COLOR GL_ZERO
}
}


(Mr_Tickles) #2

Ummm, maybe you’ve left out the extensions on the texture names?

Maybe change the 0.5 to something like 10, then you can see if the images are being flicked through too quickly. The Wilsflame shader for ET has a frequency for 10, and that’s for flickering fire…

Also, you could swap the lightmap stage there with the animation stage… not sure if this will make much of a difference, but most of the shaders I’ve seen have the lightmap bit last…


(PleaseMYOB) #3

Here is a copy of on directly from the game…

Keep in mind these are 3 seperate computer panels, without matching textures… So I am lost on the alias key… But maybe you can explain what it is… if they don’t share the same textures?

textures/liner/controlbox1
{
q3map_material Computer
damageShader textures/liner/controlbox1_d 1
{
map $lightmap
}
{
animMap 0.2 textures/liner/controlbox1
blendFunc GL_DST_COLOR GL_ZERO
}
{
map textures/liner/controlbox1_glow
blendFunc GL_ONE GL_ONE
detail
}
}

textures/liner/controlbox2
{
q3map_material Computer
damageShader textures/liner/controlbox2_d 1
aliasShader textures/liner/controlbox1
{
map $lightmap
}
{
animMap 0.1 textures/liner/controlbox2 textures/liner/controlbox2_overlay
blendFunc GL_DST_COLOR GL_ZERO
}

textures/liner/controlbox3
{
q3map_material Computer
damageShader textures/liner/controlbox3_d 1
aliasShader textures/liner/controlbox1
{
map $lightmap
}
{
map textures/liner/controlbox3
blendFunc GL_DST_COLOR GL_ZERO
}
}


(Mr_Tickles) #4

Ummm, could you please make use of the code tags, it’s a bit easier to read your code when you do that… [ Code ] … [ /Code ]

Ok, first things first, have you put the shader in the shaderkist.txt?
Do the images which you’re using have dimensions in powers of 2? i.e. 128x128, 256x512 64x32

This is the shader for the flickering flame I was talking about above:

textures/sfx/wilsflame1
{
	qer_editorimage textures/sfx/flame1.tga
	q3map_surfacelight 1482
	cull none
	nofog
	surfaceparm nomarks
	surfaceparm nonsolid
	surfaceparm pointlight
	surfaceparm trans
	{
		animMap 10 textures/sfx/flame1.tga textures/sfx/flame2.tga textures/sfx/flame3.tga textures/sfx/flame4.tga textures/sfx/flame5.tga textures/sfx/flame6.tga textures/sfx/flame7.tga textures/sfx/flame8.tga
		blendFunc GL_ONE GL_ONE
		rgbGen wave inverseSawtooth 0 1 0 10
	}
	{
		animMap 10 textures/sfx/flame2.tga textures/sfx/flame3.tga textures/sfx/flame4.tga textures/sfx/flame5.tga textures/sfx/flame6.tga textures/sfx/flame7.tga textures/sfx/flame8.tga textures/sfx/flame1.tga
		blendFunc GL_ONE GL_ONE
		rgbGen wave sawtooth 0 1 0 10
	}
	{
		map textures/sfx/flameball.tga
		blendFunc GL_ONE GL_ONE
		rgbGen wave sin .6 .2 0 .6
	}
}

I don’t know if this will help, but it may be good to have a look at another animMap shader to give you a few more ideas… notice the .tga extensions, I realize the shaders from the game don’t use them as you’ve posted above, but just to be on the safe side…

I’m not sure what the aliasShader does either, looks interesting though, maybe it’s like a baseShader but maybe runs them simultaneously. However, the Wilsflame shader doesn’t use an aliasShader so you may not have to to get it to work… hopefully.

Ummm, you could try changing your blendFunc to GL_ONE GL_ONE, the controlbox1’s animMap looks as if it’s calling itself which i’m confused about, but the blend there would get it to blend in with itself, you don’t have that so just use GL_ONE GL_ONE.


(ydnar) #5

The SOF2 shaders are fine. Lightmap should be the first stage anyway.

Do you actually have TGA, JPG or PNG images at the location referenced by your shader?

y


(PleaseMYOB) #6

I have the JPG’s and they are 16x16 for testing, as I haven’t made the actual images I’m going to be using yet…

its not the images… unless they need to be a TGA or PNG as they are JPG’s, but by Ydnar’s post they can be JPG’s…

I have updated the shaderlist… so it’s not that…

This is waht I’m looking for… If it helps…

a sign that flops images between time/tempature about every 1-3 seconds, depending on limiataion. I just chose 0.5 as a “place holder”

I read that it is a 1 second limit, or 1 second limit per image… So I figured 0.5 was a safe value…

Now to test a TGA instead, what would I save as…

16/24/32 bit

and I assume uncompressed…


Been messing with it as I was filling in post, to give as much detail…

and this works…


textures/pleasemyob/animated_test 
{ 
   q3map_material	Computer
   qer_editorimage textures/pleasemyob/qe_animated.jpg 
  surfaceparm nonsolid
   { 
      animMap 3 textures/pleasemyob/animated1.jpg textures/pleasemyob/animated2.jpg 

textures/pleasemyob/animated3.jpg 
      blendFunc GL_ONE GL_ONE 
   } 
}

I think I have it from here, thanks guys… :drink: