From ff8feb8f314e7f5d445b267853eeca022906bf05 Mon Sep 17 00:00:00 2001 From: jal Date: Sat, 12 Jun 2010 13:36:06 +0200 Subject: [PATCH 1/2] Apply floodlight to vertex lighting (there seems to remain some problem with vertexlighting not receiving enough bounced light) --- tools/quake3/q3map2/light_ydnar.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index 6a54389e..70c728d0 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -2584,6 +2584,8 @@ void IlluminateVertexes( int num ) rawLightmap_t *lm; bspDrawVert_t *verts; trace_t trace; + float floodLightAmount; + vec3_t floodColor; /* get surface, info, and raw lightmap */ @@ -2661,11 +2663,20 @@ void IlluminateVertexes( int num ) VectorCopy( verts[ i ].normal, trace.normal ); /* r7 dirt */ - if( dirty ) + if( dirty && !bouncing ) dirt = DirtForSample( &trace ); else dirt = 1.0f; + /* jal: floodlight */ + floodLightAmount = 0.0f; + VectorClear( floodColor ); + if( floodlighty && !bouncing ) + { + floodLightAmount = floodlightIntensity * FloodLightForSample( &trace, floodlightDistance, floodlight_lowquality ); + VectorScale( floodlightRGB, floodLightAmount, floodColor ); + } + /* trace */ LightingAtSample( &trace, ds->vertexStyles, colors ); @@ -2674,6 +2685,9 @@ void IlluminateVertexes( int num ) { /* r7 dirt */ VectorScale( colors[ lightmapNum ], dirt, colors[ lightmapNum ] ); + + /* jal: floodlight */ + VectorAdd( colors[ lightmapNum ], floodColor, colors[ lightmapNum ] ); /* store */ radVertLuxel = RAD_VERTEX_LUXEL( lightmapNum, ds->firstVert + i ); @@ -2720,6 +2734,9 @@ void IlluminateVertexes( int num ) { /* r7 dirt */ VectorScale( colors[ lightmapNum ], dirt, colors[ lightmapNum ] ); + + /* jal: floodlight */ + VectorAdd( colors[ lightmapNum ], floodColor, colors[ lightmapNum ] ); /* store */ radVertLuxel = RAD_VERTEX_LUXEL( lightmapNum, ds->firstVert + i ); From 1e42a4f0959d25b435d0b08e0cbe6521fbcced6d Mon Sep 17 00:00:00 2001 From: jal Date: Mon, 14 Jun 2010 19:50:45 +0200 Subject: [PATCH 2/2] Fix vertexlighting and gridlighting being too dark when using floodlight and bounce (stop floodlighting being re-applied to lightmaps with each bounce stage) --- tools/quake3/q3map2/light_ydnar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index 70c728d0..b32c9a29 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -2359,7 +2359,8 @@ void IlluminateRawLightmap( int rawLightmapNum ) FreeTraceLights( &trace ); /* floodlight pass */ - FloodlightIlluminateLightmap(lm); + if( floodlighty ) + FloodlightIlluminateLightmap(lm); if (debugnormals) {