Legacy:Vertex Lighting - Unreal Wiki

# Legacy:Vertex Lighting

### From Unreal Wiki, The Unreal Engine Documentation Site

Lights a mesh based on light reaching each polygon vertex.

## When Vertex Lighting occurs in Unreal

- on meshes
- not on BSP (uses lightmaps)
- Originally built into rendering software
- Built into 3D graphics cards for speed

## How it works

Each polygon has a minimum of 3 vertices. If light is cast towards the polygon, each vertex will usually receieve a differing light level. Vertex lighting blends the light level on the surface of the polygon based on the vertex light levels.

Because of this blend, neighboring polygons will also appear smooth, resulting in a smooth mesh surface even if the mesh geometry is coarse. However, a coarse polygon will still be detected by seeing its edges and comes with its own set of problems.

Can mesh light smoothing be toggled? Category:Legacy Answer Needed

Foxpaw: In UT there is an actor setting bCurvyMesh which I believe does this. In UT2003 I believe you can do it using materials, but I can't say that with certainty.

### Stretched light or shadow

- Since light based on polys
  - avoid long stretched polys
  - Use even spaced polys for maximum light and shadow clarity

[show image]

### Low polygon

- [show light] in center fade to black on edges
- [show light] on one edge fade to black

### No shadow

- onto BSP lightmap world
- onto other meshes

## Solutions

### Smooth shading

- prevents shade 'stepping'

### Mesh detail

- Tesselation increases polygon count
- Increased polygons = increased lighting detail

### Weld vertices

Dont place static mesh on top or near others

- Make one mesh by welding vertices
- SHadows calcualted across entire mesh

## If its still too bright or dark

You can always toggle a few parameters in the mesh's actor properties:

- bStaticTrue -> false
  - alters lighting on badly lit meshes
  - Instead of being lit on a per-vertex basis, the mesh takes a direct trace from the eight nearest lightsources and uses those for its lighting. Useful if you end up with a black mesh because a couple of vertices aren't receiving light.
  - Downsides - The entire mesh will appear to be too bright because it is being lit as a whole by eight separate lights. Additionally, the mesh will no longer cast a shadow. Also, if you have two wildly contrasting lights near the mesh you will end up with some pretty funky lighting ;)

[show image]

## Black-Lit meshes (A workaround using blocking volumes)

Pretty much anyone who has used UnrealEd 3 will have experienced those horrible black meshes caused by certain vertices not receiving light. Here's a handy workaround to provide nice lighting, with shadows, and retain functionality of the mesh:

All that is needed for this to work is a single collision property in the mesh itself, and a BlockingVolume. Select your badly lit mesh and set its bBlockZeroExtentTraces collision property to false. This will mean the mesh effectively becomes non-solid to objects such as lights and weaponsfire. Therefore it logically follows that light will be able to penetrate the mesh and reach otherwise hidden vertices. That solves the black mesh problem, and also allows the mesh to be nicely lit (unlike the bStaticLight property).

Next, you need to make a BlockingVolume in the correct size and shape to cover the mesh as closely as possible. In its collision properties, set bBlockZeroExtentTraces to TRUE this time. Now you might be wondering why we're setting this to true when it should block lights again. The simple answer is that blocking volumes don't work the same as meshes, and lighting will still be able to travel through the volume to reach the mesh. However, the volume *will* block both coronas and weaponsfire. There you have it, a nicely lit mesh that still blocks coronas aand weapons. Neat, huh? :D

- Displayglow
  - 1.0 is maximum

- Ambientglow
  - changes overall lighting

- enable bUnlit
  - Full bright mesh reveals texture only
  - uses no lighting

- toggle bShadowcast
  - mesh doesnt block light

### Projectors (UT2003 and later)

- If mesh is not bright but surrounding area is
- example: light area around a lamp mesh
- if BSP world is correctly lit
  - project light onto mesh only

## Related Topics

- Hourences' tute: http://planetunreal.com/phalanx/tut%27s/tutorial_vertex.htm
- General lighting

## Discussion

Radiosity: I've added my personal workaround for those dastardly black-lit meshes, hope it helps anyone who might read this :)

Category:Legacy Mapping
Category:Legacy To Do – Add image examples as indicated above.

Categories: Legacy Answer Needed | Legacy Mapping | Legacy To Do

##### Views

- Legacy
- Discussion
- Current revision

##### Search