Terrain Shaderfile.


(Mark.C) #1

Please someone help me, i have never mastered shader files for terrain. I keep getting the stupid orange squares.

textures/castle/terrain_base
{
	nopicmips
	q3map_lightmapaxis z
	q3map_lightmapmergable
	q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )

textures/castle/terrain_0
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_1
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/sand_patchnoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_patchnoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_2
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/sand_bubbles_bright.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_bubbles_bright.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_3
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/sand_disturb_bright.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_disturb_bright.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_0to1
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_0to2
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_0to3
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_1to2
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/sand_patchnoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_patchnoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_1to3
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/sand_patchnoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_patchnoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/castle/terrain_2to3
{
	q3map_baseshader textures/castle/terrain_base
	qer_editorimage textures/temperate_sd/sand_bubble_bright.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rocky_sand.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain
{
	surfaceparm nolightmap
	q3map_novertexshadows
	q3map_forcesunlight
	{
		map textures/rock_graynoise.tga
		rgbGen vertex
	}
}

(Shaderman) #2
  1. There’s a closing brace missing for textures/castle/terrain_base.
  2. The qer_editorimage path in textures/vxcastle/terrain_2to3 is wrong. Should be textures/temperate_sd/sand_bubbles_bright.tga
  3. I suggest you rename the shader paths and use vxcastle instead of castle to separate your work from existing shaders.

(Mark.C) #3

Thanks Shaderman. Does this look ok now ?

textures/vxcastle/terrain_base
{
	nopicmips
	q3map_lightmapaxis z
	q3map_lightmapmergable
	q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )
}

textures/vxcastle/terrain_0
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_1
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/sand_patchnoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_patchnoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_2
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/sand_bubbles_bright.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_bubbles_bright.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_3
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/sand_disturb_bright.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_disturb_bright.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_0to1
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_0to2
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_0to3
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/rock_graynoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rock_graynoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_1to2
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/sand_patchnoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_patchnoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_1to3
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/sand_patchnoise.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/sand_patchnoise.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain_2to3
{
	q3map_baseshader textures/vxcastle/terrain_base
	qer_editorimage textures/temperate_sd/sand_bubbles_bright.tga
	surfaceparm landmine
	surfaceparm grasssteps
	{
		map textures/temperate_sd/rocky_sand.tga
		tcMod scale 0.125 0.125
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/vxcastle/terrain
{
	surfaceparm nolightmap
	q3map_novertexshadows
	q3map_forcesunlight
	{
		map textures/rock_graynoise.tga
		rgbGen vertex
	}
}


(Shaderman) #4

Yes, looks good.


(Mark.C) #5

I changed this …

textures/vxcastle/terrain_base 
{ 
   nopicmips 
   q3map_lightmapaxis z 
   q3map_lightmapmergable 
   q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 ) 
} 

To this…

textures/vxcastle/terrain_base 
{ 
   nopicmips 
   q3map_lightmapaxis z 
   q3map_lightmapmergable 
   q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 ) 
} 

And absolutely none of the textures blend at all. Just a clear line between the textures.


(RayBan) #6

it doesnt look like you have any blending stages in your shader for the area’s that are meant to blend… ie… 1to3 only maps 1 texture with
no other texture for the blend.


(RayBan) #7

i may be incorrect, but it should look something like this,


textures/vxcastle/terrain_base
{
   nopicmips
   q3map_lightmapaxis z
   q3map_lightmapmergable
   q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
}

textures/vxcastle/terrain_0
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/rock_graynoise.tga
   //surfaceparm landmine
   //surfaceparm grasssteps
   {
      map textures/temperate_sd/rock_graynoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_1
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/sand_patchnoise.tga
   surfaceparm landmine
   surfaceparm grasssteps
   {
      map textures/temperate_sd/sand_patchnoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_2
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/sand_bubbles_bright.tga
   surfaceparm landmine
   surfaceparm grasssteps
   {
      map textures/temperate_sd/sand_bubbles_bright.tga
      tcMod scale 0.125 0.125
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_3
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/sand_disturb_bright.tga
   surfaceparm landmine
   surfaceparm grasssteps
   {
      map textures/temperate_sd/sand_disturb_bright.tga
      tcMod scale 0.125 0.125
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_0to1
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/rock_graynoise.tga
   //surfaceparm landmine
   //surfaceparm grasssteps
   {
      map textures/temperate_sd/rock_graynoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map textures/temperate_sd/sand_patchnoise.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_0to2
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/rock_graynoise.tga
   //surfaceparm landmine
   //surfaceparm grasssteps
   {
      map textures/temperate_sd/rock_graynoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map textures/temperate_sd/sand_bubbles_bright.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_0to3
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/rock_graynoise.tga
   //surfaceparm landmine
   //surfaceparm grasssteps
   {
      map textures/temperate_sd/rock_graynoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map textures/temperate_sd/sand_disturb_bright.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_1to2
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/sand_patchnoise.tga
   surfaceparm landmine
   surfaceparm grasssteps
   {
      map textures/temperate_sd/sand_patchnoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map textures/temperate_sd/sand_bubbles_bright.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_1to3
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/sand_patchnoise.tga
   surfaceparm landmine
   surfaceparm grasssteps
   {
      map textures/temperate_sd/sand_patchnoise.tga
      tcMod scale 0.125 0.125
   }
   {
      map textures/temperate_sd/sand_disturb_bright.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain_2to3
{
   q3map_baseshader textures/vxcastle/terrain_base
   qer_editorimage textures/temperate_sd/sand_bubbles_bright.tga
   surfaceparm landmine
   surfaceparm grasssteps
   {
      map textures/temperate_sd/rocky_sand.tga
      tcMod scale 0.125 0.125
   }
   {
      map textures/temperate_sd/sand_disturb_bright.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}

textures/vxcastle/terrain
{
   surfaceparm nolightmap
   q3map_novertexshadows
   q3map_forcesunlight
   {
      map textures/rock_graynoise.tga
      rgbGen vertex
   }
} 

i have commented out some stuff like the surfaceparm landmine and grassteps in a few
of the shader area’s, since i dont think you want to be able to plant landmines on
rock surfaces, however thats up to you.


(Mark.C) #8

Still got the lines + the rock texture looks like its 1024 x 1024 instead of 256 x 256 ?


(RayBan) #9

how did you make this terrain, in easygen?


(Mark.C) #10

yep.


(RayBan) #11

ok, what you need to do is check out some things 1st and see where the problem is, you say the textures are showing up now, so it should be
reading the shader file… so open up radiant, load the map, and select the terrain ( all of it, or just one brush ) bring up the entity window
and see what the key/values are… its a func_group but what do the others say…
should be something like,
terrain 1
shader vxcastle/terrain
layers 4
alphamap vxcastle.pcx

check to see if the terrain has similar values like that, if it doesnt do not change them, but post here on what is different, then we
can take it from there.