Foliage fade out over distance


(Madras) #1

Hi,
I added foliage to my map by the shader but I have a problem because foliage fade out over distance.
How to increase draw distance of the foliage?
Thanx for help ;D

Border of drawing:

Foliage part of shader:

textures/depot/lmterrain2_base
{
	q3map_normalimage textures/sd_bumpmaps/normalmap_terrain.tga
	
	q3map_lightmapsize 512 512
	q3map_lightmapMergable
	q3map_lightmapaxis z
	
	q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
	q3map_tcMod scale 2 2
	q3map_tcMod rotate 37
}

textures/depot/lmterrain2_foliage_base
{
	q3map_baseShader textures/depot/lmterrain2_base

//	q3map_foliage <model> <scale> <density> <odds> <use inverse alpha>
	q3map_foliage models/foliage/grassfoliage1.md3 1.25 48 0.1 2
	q3map_foliage models/foliage/grassfoliage2.md3 1.1 48 0.1 2
	q3map_foliage models/foliage/grassfoliage3.md3 1 48 0.1 2
}

[…]

textures/depot/lmterrain2_1
{
	q3map_baseshader textures/depot/lmterrain2_foliage_base
	surfaceparm gravelsteps
	surfaceparm landmine

	{
		map textures/stone/mxrock1b.tga
		rgbgen identity
	}
	{
		lightmap $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		rgbgen identity
	}
}

(-SSF-Sage) #2

It is the distancecull line on the foliage model’s shader. Do not edit the original file. Make a new shader for it.


(Avoc) #3

A bit offtopic, but I noticed “normalmap_terrain.tga”
I hope its not bumpmapping you are talking about…


(Madras) #4

I wrote shader with distanceCull line, but it doesnt work :((
Any ideas?

textures/depot/lmterrain2_foliage_base
{
	q3map_baseShader textures/depot/lmterrain2_base

	[B]distanceCull 8192 8192 0.4[/B]

//	q3map_foliage <model> <scale> <density> <odds> <use inverse alpha>
	q3map_foliage models/foliage/grassfoliage1.md3 1.25 48 0.1 2
	q3map_foliage models/foliage/grassfoliage2.md3 1.1 48 0.1 2
	q3map_foliage models/foliage/grassfoliage3.md3 1 48 0.1 2
}


(MrLego) #5

I’m working on the same thing ATM.

The shader you want is “etmain/scripts/models_foliage.shader”

Look for the “models/foliage/grassfoliage1” , “models/foliage/grassfoliage2”, “models/foliage/grassfoliage3” sections.

Remember to put the modified shaders in your own shader file, leave the original ones alone.


(Madras) #6

ok but how to deploy foliage on my own map without using models?

I have own models and I want to increase draw distance of foliage…
So what I must modify in this shader to enlarge distance.

textures/depot/lmterrain2_foliage_base
{
	q3map_baseShader textures/depot/lmterrain2_base

//	q3map_foliage <model> <scale> <density> <odds> <use inverse alpha>
	q3map_foliage models/foliage/grassfoliage1.md3 1.25 48 0.1 2
	q3map_foliage models/foliage/grassfoliage2.md3 1.1 48 0.1 2
	q3map_foliage models/foliage/grassfoliage3.md3 1 48 0.1 2
}

Sorry for my bad English


(-SSF-Sage) #7

Nothing in this shader. Go to the shader of the actual grass models! (models/foliage/grassfoliage1…). From there you will find distancecull command which you are supposed to edit. Do note that making the draw distance too far can kill your fps.

edit. http://tramdesign.planetwolfenstein.gamespy.com/tutorials/etdocs/foliage.html


(Madras) #8

It works! Now game draw very far grass and fps looks great :stuck_out_tongue:
Thank you very much for helping! :smiley: