Originally posted by Lil Killa
http://map-review.com/index.php?page=tutorial_view&id=12)
I have a few quick questions on vertex lighting...
What is it? how does it work? Does it ignor all of the shadows in my map and ignor all of my ent lights?
Fist of all you don’t need to use vertex lit (...lighted) terrain as long as you have to. There’s a problem with the fog on lightmapped terrain with more that two layers and the vertex lighted terrain is the solution. That’s why rgoer has chosen it for his example.
In lightmap you have a map of light assigned to every surface. It’s like an additional bitmap data (imagine it as an additional tga changel/or another shader stage) but in lower resolution. The resolution is controlable by _lighmapscale key. If you have let’s say a bitMAP in size of 512x512 you will have a lightMAP in size 16x16 with shadows and light stretched to the size of your bitMAP. This is the lightmap. Am I right?
The vertex light is based on object tessellation structure (triangles) and strictly depends on it. If you create a very dense object like a grid (surface) you can achieve the same effect like using the lightmap by the cost of higher number of surfaces (triangles). See the example:
Normal brush surface, only two triangles can be shadowed / illuminated
http://www.mslaf.com/tutorials/tessgrid1.jpeg)
More dense grid, and more detailed shadows / lights
http://www.mslaf.com/tutorials/tessgrid2.jpeg)
Very dense grid, and very detailed shadows / light
http://www.mslaf.com/tutorials/tessgrid3.jpeg)
And a sample how the “X” shadow will be created (hand painted sorry)
http://www.mslaf.com/tutorials/tessgridshadow.jpeg)
VL it’s faster for the renderer, because there’s less light/shadow data to process but offers lower quality and is sometimes very difficult to control. You don’t know how the brush will be split into triangles by q3map2’s tjunction procedure.
In bright areas you will see no big difference between lightmap and vertex light.
The best way to see what is vertex light in reality without going into technical details is to change the setup option from “lightmap” to “vertex light”. And...you can always try old good Jedi Knight to see it too;). The vertex lighted surfaces are illuminated in the same way as anything else so your light entities will work with them.
Try to experiment with them yourself to see the advantages and disadvantages.
Sample vertex shaders are here:
http://www.splashdamage.org/index.php?name=pnPHPbb2&file=viewtopic&t=8643&sid=c7c6f93b130c78b1083fd2fecb1eafc1)