phong shaded blended terrain?


(Kobayashi) #1

So i have managed to get the terrain blending to work and now i want to apply
phong shading to it (and possibly some bump-mapping). :smiley:
How would one go about setting this up?

Edit:
here are my shaders also… terrain & phong

textures/termap/termap_terrain_1
{
	{
		map textures/desert_sd/road_dirty_gravel.tga
	}
	{
		map textures/desert_sd/sand_wave_desert.tga
		blendfunc blend
		alphagen vertex
	}
	{
		map $lightmap
		blendfunc gl_dst_color gl_zero
		rgbgen identity
	}
}
textures/termap/termap_phong1
{
	q3map_nonplanar
	q3map_shadeangle 120
	{
		map $lightmap
		rgbgen identity
	}
	{
		map textures/desert_sd/road_dirty_gravel.tga
		blendfunc filter
	}
}

I don’t know how to combine these two into an efficient shader… was looking into
baseshaders but not sure how to implement it.

/Kobayashi


(carnage) #2
textures/termap/termap_terrain_1
{
	q3map_nonplanar
   	q3map_shadeangle 120 
   {
      map textures/desert_sd/road_dirty_gravel.tga
   }
   {
      map textures/desert_sd/sand_wave_desert.tga
      blendfunc blend
      alphagen vertex
   }
   {
      map $lightmap
      blendfunc gl_dst_color gl_zero
      rgbgen identity
   }
}

there is the shaders. however i must laugh in your face at the mere surgestion of bumpmapping terrain on a compiler exporting lightmaps… hahahahaha… the resolution required by the lightmap… lol… accorss the surface of an entire terrain mesh… rofl…

bumpmaping requires a very high resolution lightmap to store enough pixels to make the actual effect of the bumpmapping noticable. you would pretty much need a lughtmap at the same resolution of the texture on the terrain so your going to end up with a MASSIVE amount of lightmaps and ither hit the max lightmaps limit or make your download size so ugly that no1 will download it


(Kobayashi) #3

ah so it was that simple. thanks for that.
About the bump mapping… i didn’t know you needed a high res lightmap for it to be
noticable, i’m still learning about this stuff.
Is it the same with phong shading… higher lightmap res = better results?

/Kobayashi


(carnage) #4

ah so it was that simple. thanks for that.
About the bump mapping… i didn’t know you needed a high res lightmap for it to be
noticable, i’m still learning about this stuff.
Is it the same with phong shading… higher lightmap res = better results?

nope

phong lighting works by smoothing the light between two places not on the same orientation. in other words where you have an angle on the terrain. the terrain is still drawn in the same way and shape but the smooth lighting hides the edges and seams on the angles between the brushes so the terrain looks smoother and more like its one whole lump of earth rather then made up of smaller triangles

on current lightmaps ull find the resolution of the lightmap is much smaller then the resolution of the image its going over. if it was the same you would need to save a light pixel for every pixel of texture in the map. this is clearly overkill and you would end up with too much lightmap data

bump mapping is where light is effected accross one surface. if you imagine a bump in a surface then the side of the bump facing the light source is might brighter and the side facing away is much darker. this information could be saved into the lightmaps but because they are such low resolution you dont have the presision to save the information. you could increase the lightmap of a particualr surface and bumpmap it since you would be limiting the increase in lightmaps. although the benefi of bumpmaping just one surface is questionable and you run the risk of this surface looking out of place in comparison to the rest of the map

for modern engine like doom3 lighting is not pre porcesed into lightmap but generated in real time per pixel meaning you can bumpmap pretty much everything since you dont need to store massise of high res lightmaps

afaik some have made modifications to quake3/quake2 engine that stores the direction light is hitting a surface as well as the lightmaps on the surface. meaning surfaces can be bumpmaped but the highs/lows in the lughting will be created at run time rather then pre procesed. but its unlikly that you will be developing for one of these engines

:???:


(Kobayashi) #5

That clears up alot.
I’ll probably skip bump mapping altogether.
Thanks

/Kobayashi