q3map tcgen ivector, i quit


(damocles) #1

Having read in another thread a post by ydnar stating that using a tcmod scale function in each stage of the terrain shader gives a performance hit and you should use ivector in the base shader, I figured I would do that. Sounded pretty straight forward :slight_smile:

So anyway, my problem is that the terrain has a very very high texture repeat factor. So obviously I completely misunderstood both ydnars post and how to use ivector functions. Anyway here’s some of my terrain shader to see if anyone can spot my mistake (yes, the glaringly obvious one :slight_smile: ):


textures/subpen/terrain_base
{
	q3map_globaltexture
	q3map_lightmapaxis z
	q3map_lightmapmergable
	q3map_lightmapsize 512 512
	q3map_lightmapsamplesize 16
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	//tcmod scale 0.036 0.036
	q3map_shadeangle 179
}

textures/subpen/terrain_2
{
	q3map_baseshader textures/subpen/terrain_base
	surfaceparm landmine
	surfaceparm gravelsteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		//tcmod scale 0.036 0.036
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
	{
		map textures/mp_subpen/rockdetail.tga
		blendFunc GL_DST_COLOR GL_SRC_COLOR
		detail
		tcmod scale 1 1
	}
}

textures/subpen/terrain_0to1
{
	q3map_baseshader textures/subpen/terrain_base
	{
		map textures/temperate_sd/rock_ugly_brown.tga
		//tcmod scale 0.036 0.036
	}
	{
		map textures/mp_subpen/grassy.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphaGen vertex
		//tcmod scale 0.036 0.036
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
	{
		map textures/mp_subpen/rockdetail.tga
		blendFunc GL_DST_COLOR GL_SRC_COLOR
		detail
		tcmod scale 1 1
	}
}

Feel free to point out my error, slap my wrists and then point and laugh as I skulk away into the shadows :slight_smile:


(kat) #2

if I understand the tcGen stuff correctly (being fiddling with it myself recently) you shoud use higher values as what you have there will repeat the texture every 256 game units which would give you pretty bad repeating… try using at least 512 or more usually 1024 (I’m using 512+128=640)


(damocles) #3

That’s what I tried first (because that’s how I assumed it worked). My original values were 2048. Then I tried 1024. After that I looked at the ET terrain shaders and saw they mostly used 256 and 512.

The annoying thing is, there is alsmot no difference between my shader and the ET terrain shaders, but somehow theirs works :confused: I’m wondering if perhaps there is some compile option or something that is affecting things.


(ydnar) #4

Is your shader listed in shaderlist.txt? :slight_smile:

BTW, the line:

tcMod scale 1 1

Is doing nothing other than burn CPU time. Remove it.

y


(damocles) #5

Yeah, it’s in the shaderlist :confused:

I know the tcmod scale 1 1 thing is doing nothing, I was just messing around with different detail texture sizes to see what I liked. I’ve set it to 2 2 now.