foliage models lightmapped?


(pazur) #1

Hi,

is it possilble to have lightmapped foliage models ?

look at the screenshot please… the lightmapped terrain has small stones on the ground and in areas with a shadow it looks a little bit strange.

my model shader:


models/paz/dirt3_small
{
	q3map_nonplanar
	q3map_shadeangle 179
		
	// distanceCull <inner&rt; <outer&rt; <alpha threshold&rt;
    distanceCull 1024 2048 0.4
	
    //{
    //    map models/paz/dirt3_small.tga
    //    rgbGen exactVertex
    //    alphaGen vertex
    //}
  	{
		map $lightmap
		rgbGen identity
	}
	{
		map models/paz/dirt3_small.tga
		blendFunc filter
	}
}


(Detoeni) #2

Educated guess. Foliage is added to the bsp at run time, so there is nothing in the map for q3map2 to light map.


(pazur) #3

Yea… I guess I will need to darken the model texture a little bit a live with it :beer:


(Fracman) #4

you might use the diffuse light shader for realtime added stuff:


shadername
{
  q3map_nolightmap
  {
    map texturename
    rgbGen lightingDiffuse
  }
}


(Detoeni) #5

The models are barked in the bsp in much the same way as ase/game_models so lightingDiffuse wont work.
The better option is to use vertex lighting like the originals.

models/paz/dirt3_small 
{
	qer_editorimage models/paz/dirt3_small.tga 
	// distanceCull <inner> <outer> <alpha threshold>
	distanceCull 1024 2048 0.4
	
	surfaceparm pointlight
	surfaceparm trans
	surfaceparm nomarks
	
	{
		map models/paz/dirt3_small.tga 
		rgbGen exactVertex
		alphaGen vertex
	}
}


(pazur) #6

I tried the rgbGen lightingDiffuse and also the vertex lightning. With lightningdiffuse the models look just black. With vertex they look the same as with the current lightmap shader.


(carnage) #7

could you just not use the moddles in the shadow areas or create a new foligage skin that looks darker and use that in the shadows


(pazur) #8

Unfortunately my terrain shader covers large areas… to find out areas that receive shadows and give it a different foliage shader is nearly impossible.


(Detoeni) #9

Just looking at your original shader, the bits commented out for the vertex shader. Have you tried the vertex shader with “surfaceparm pointlight”?


(pazur) #10

no i havent tried yet… i will give it a try


(Detoeni) #11

The shader manual is a bit vage about this key, I’v got a feeling its to do with how the object gets its vertex values.