Browse Source

Use per-face vertex lighting for improved geometry definition and less light leaking between sharp-angled surfaces.

tess_experiment
Nico de Poel 3 years ago
parent
commit
36c409115a
  1. BIN
      test.ps1bsp
  2. 4
      world.c

BIN
test.ps1bsp

4
world.c

@ -231,6 +231,8 @@ static void world_drawface(const world_t *world, const ps1bsp_face_t *face)
cam_vec.vz = center.vz - cam_pos.vz;
const ps1bsp_plane_t *plane = &world->planes[face->planeId];
// NOTE: this value could be REALLY useful for determining the tessellation subdivisions. It has camera distance *and* angle in it.
// Just include the face size/area for an approximate screen size. Maybe also separate x/y/z for angle-dependent tessellation.
short dot = world_planeDot(&cam_vec, plane);
if ((dot >= 0) ^ face->side)
return;
@ -244,7 +246,7 @@ static void world_drawface(const world_t *world, const ps1bsp_face_t *face)
{
const ps1bsp_vertex_t *vert = &world->vertices[faceVertex->index];
vecs[vertIdx] = *((SVECTOR*)vert);
vecs[vertIdx].pad = vert->baseLight;
vecs[vertIdx].pad = faceVertex->light;
}
if (face->numFaceVertices == 3) // Special case: draw single triangles using the simplest method

Loading…
Cancel
Save