Jump to content

Terrain Entity Grass Sprite Shader


Recommended Posts

I was near completion of my newest map, when I realized that grass sprites weren't present on the group entity used for terrain.  Everything else functions as desired, all other shaders have been successfully integrated without error, and even my grass sprite texture functions as desired when applied to a standard worldspawn brush, yet when applied to terrain, the sprite portion of it fails to load.  I have determined that this failure is caused by the fact that the terrain brushes are part of a single group entity, and in some way this disables the ability of the shader to include sprites.  The q3map_material was obviously retained regardless of the entity status of the brushes the shader was applied to, along with a few other lighting properties, excluding only the sprites.

 

This ability for the map to include grass sprites on the terrain is fundamental to the concept of the map.  I spent quite a long time perfecting the functionality of the grass shader specifically for the purpose of applying it to the terrain brushes.

 

I have already attempted making the terrain brushes part of the worldspawn, but this results in an unavoidable safe_malloc error during the light portion of compilation (the pc used for compilation has 8GB of Ram and a 4 core 2.8GHz processor, and the >2GB Memory Q3map2.exe was used) , and as a result is not an option.  Precautions to avoid excessive lag (such as detail v. structural brushes, use of patchwork when possible, etc.) have already been taken as well.

 

To emphasize, the only problem is the grass sprites not loading on terrain brushes.  Any ideas or assistance are greatly appreciated.

 

 

Grass Shader:

 

 

textures/2_modernist/wildgrass
{
	q3map_normalimage	textures/2_modernist/grass_normal
	qer_editorimage textures/2_modernist/wildgrass
	q3map_material ShortGrass
	q3map_nonplanar
	q3map_shadeangle 120
	{
		map $lightmap
	}
	{
		map textures/2_modernist/wildgrass
		blendFunc GL_DST_COLOR GL_ZERO
	}
	{
		map textures/2_modernist/grassprites1
		surfaceSprites vertical 15 12 20 225
		ssFademax 1500
		ssFadescale 1
		ssVariance 1 2
		ssWind 0.5
		alphaFunc GE192
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		depthWrite
		rgbGen vertex
	}
	{
		map textures/2_modernist/grassprites2
		surfaceSprites vertical 15 15 24 275
		ssFademax 150
		ssFadescale 1
		ssVariance 1 2
		ssWind 0.5
		alphaFunc GE192
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		depthWrite
	}
} 

 

 

Link to comment
  • 2 weeks later...

@

 

Sorry for the late reply, I kind of assumed this topic was already dead.  I haven't actually checked to see if the sprites were being rendered on the inverse side of the texture, that had not occurred to me as a possibility.  Is that a common shader problem that I was unaware of?  Either way, I'll have to check and see.

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...