Can phong shading replace terrain entities?


(RabidCow) #1

I have been experimenting using the global -shade -shadeangle 180 switches with q3map2.3.33. I am trying to build beautiful outdoor maps with very high performance by using simple vertex edited brushes and phong shading as an alternative to terrain. My first results are encouraging. Here is a screenie of ut_twinlakesv2 done with no terrain entity or shader. The ground is textured with a simple snow texture, the same as was used for the terrain shader. It looks a bit “shallow” shall we say, in the texture itself…but I think that is a result of the sharp, unmanipulated texture. Shadows fall nicely from the trees and players throw dynamic shadows on the snow. All the normal pains of terrain, such as surface sounds being a problem, etc, are gone.

an early example shows the effectiveness of phong shading in comparison to the same subject without phong.

The final screenshot shows a simple box with vertex edited brushes and phong shading, using a better lighting setup.

So, the question is…does anyone have any more great ideas to make phong shaded, vertex edited brushes even more like terrain in the good ways? Thanks to Ydnar for the wonderful Christmas present! It works far better than I had ever expected it would!


(FSF-Moses) #2

Looks very nifty! I didn’t try it myself yet but this will push me in the right direction of the use of phong shading in my current project.
I have some outdoor areas which look kinda flat.

Thanks for showing some sample-screenshots!


(system) #3

The shots are very good. But what will you do if you want several different textures on your terrain??


(RabidCow) #4

With several different textures it would definitely be more of a challenge but a good example of a non-terrain outdoor map is ut_paradise. It looks very nice, with lots of fine textures. I bet if it was compiled with phong shading, it would be amazing. At least you wouldn’t need the multipass terrain shaders that can eat fps…I’m sure it would be a compromise but you could also use actual terrain entities in spots where it was absolutely necessary.


(RabidCow) #5

With several different textures it would definitely be more of a challenge but a good example of a non-terrain outdoor map is ut_paradise. It looks very nice, with lots of fine textures. I bet if it was compiled with phong shading, it would be amazing. At least you wouldn’t need the multipass terrain shaders that can eat fps…I’m sure it would be a compromise but you could also use actual terrain entities in spots where it was absolutely necessary.


(RabidCow) #6

sorry about the multiple post…got some errors


(ydnar) #7

Using terrain is more efficient because the brush faces are meshed together into a nice nonplanar surface. Using -shadeangle 180 in the light phase just shades the lightmaps based on interpolated normals, but each face is still a distinct surface.

You might have noticed the vertex & surface r_speeds in Twinlakes jump significantly…

The best way to do nonplanar mesh stuff w/o terrain is to make a shader with these two directives:

q3map_nonplanar
q3map_shadeangle 120 // or 90, 160, etc. higher values may cause errors

Note that you can apply normal Q3Map2 terrain shaders directly to brush faces–the q3map_tcGen ivector stuff works in any shader. This keeps the texture coordinates aligned so the meta meshing is as efficient as possible.

y


(RabidCow) #8

Thanks for the tips Ydnar :). I will do some more experimenting. I had tested the fps on twinlakes and found it was not as good as I expected, nor did it quite look as good in texturing. I initially expected better performance in-game due to the reduction in shaders…BTW, how many terrain shaders are we limited to in a map? I know there are two existing in the game. Can I make four or five? Building smaller boxes is usually more efficient but could I use a single lightmap for four separate boxes? I guess it doesn’t really matter, as long as I can func_group brushes and apply a shader with q3map_nonplanar and q3map_shadeangle. Thanks again for the help!


(RabidCow) #9

My dsl line is being flakey so I don’t know if you will be able to see these screenies. The first is non-terrain using a shader with q3map_nonplanar and q3map_shadeangle 120. I tried the same shader with shadeangle 180 with no apparent change

I was concerned about the visibility of the polys in the above shot, so I tried a few more things and ended up leaving it as above but I added the -shadeangle 180 back into the lighting phase during complile as a global switch. The result was this…

As you can see, it is much smoother…which brings me to the question, what is different with the way phong shading is applied when used in a shader as opposed to when it is used as a global switch during compile?

My shader is this…

textures/jeffj/artic
{
q3map_nonplanar
//q3map_normalimage textures/jeffj/normaltl2.tga
//q3map_lightmapmergable
q3map_shadeangle 120
//q3map_lightmapaxis z
//q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/jeffj/artic_dn3.tga
rgbGen identity
}
{
map $lightmap
tcGen lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
}

The lines that are commented out did not make any apparent difference during testing.