diff --git a/utils/pxrad/ambientcube.cpp b/utils/pxrad/ambientcube.cpp index 005cae4e..ceb1e3a8 100644 --- a/utils/pxrad/ambientcube.cpp +++ b/utils/pxrad/ambientcube.cpp @@ -272,7 +272,7 @@ static void CalcRayAmbientLighting( int threadnum, const vec3_t vStart, const ve if( trace.surface == STUDIO_SURFACE_HIT ) { for (int i = 0; i < MAXLIGHTMAPS; i++ ) - if( (trace.styles[i] == LS_NORMAL)||(trace.styles[i] == LS_SKY)) //only sun and default style + if( (trace.styles[i] == LS_NORMAL)||(trace.styles[i] == LS_SKY)||(trace.styles[i] == g_skystyle)) //only sun, sky and default style VectorAdd( radcolor, trace.light[i], radcolor ); //Msg( "model hit, color %f %f %f\n", radcolor[0], radcolor[1], radcolor[2] ); return; @@ -296,7 +296,7 @@ static void CalcRayAmbientLighting( int threadnum, const vec3_t vStart, const ve scaleAvg = 4.0f * M_PI / ((float)NUMVERTEXNORMALS * scaleAvg); //ratio of ray cone and face solid angles scaleAvg = bound( 0.0f, scaleAvg, 1.0f ); for (int i = 0; i < MAXLIGHTMAPS; i++ ) - if( (info.styles[i] == LS_NORMAL)||(info.styles[i] == LS_SKY)) //only sun and default style + if( (info.styles[i] == LS_NORMAL)||(info.styles[i] == LS_SKY)||(info.styles[i] == g_skystyle)) //only sun, sky and default style { VectorLerp( info.diffuse[i], scaleAvg, info.average[i], temp_color ); VectorAdd( radcolor, temp_color, radcolor ); diff --git a/utils/pxrad/lightmap.cpp b/utils/pxrad/lightmap.cpp index 7f668f86..d3e1847a 100644 --- a/utils/pxrad/lightmap.cpp +++ b/utils/pxrad/lightmap.cpp @@ -2589,7 +2589,7 @@ vec3_t *s_light, vec3_t *s_dir, vec_t *s_occ, byte *styles, byte *vislight, bool VectorScale( add, 4.0f * g_indirect_sun / (float)g_numskynormals[skylevel], add ); VectorScale( add_direction, 4.0f * g_indirect_sun / (float)g_numskynormals[skylevel], add_direction ); - AddSampleLight( threadnum, topatch, add, add_direction, LS_NORMAL, s_light, s_dir, s_occ, styles ); + AddSampleLight( threadnum, topatch, add, add_direction, g_skystyle, s_light, s_dir, s_occ, styles ); } } @@ -4408,6 +4408,8 @@ void ReduceLightmap( void ) SetKeyValue( &g_entities[0], "_smooth", va( "%.2f", g_smoothvalue )); if( g_hdrcompresslog ) SetKeyValue( &g_entities[0], "_hdr", "compress_log" ); + if( g_skystyle ) + SetKeyValue( &g_entities[0], "_skystyle", va( "%d", g_skystyle )); int oldsize = g_lightdatasize; diff --git a/utils/pxrad/qrad.cpp b/utils/pxrad/qrad.cpp index d845f988..4b0c090a 100644 --- a/utils/pxrad/qrad.cpp +++ b/utils/pxrad/qrad.cpp @@ -76,11 +76,11 @@ rgbdata_t *g_skytextures[6]; vec_t g_lightprobeepsilon = DEFAULT_LIGHTPROBE_EPSILON; bool g_vertexblur = false; uint g_numstudiobounce = DEFAULT_STUDIO_BOUNCE; -int g_studiogipasscounter = 0; +int g_studiogipasscounter = 0; vec3_t *g_studioskynormals; -int g_numstudioskynormals; +int g_numstudioskynormals; bool g_noemissive = false; - +int g_skystyle = LS_NORMAL; bool g_drawsample = false; @@ -2761,6 +2761,7 @@ static void PrintRadUsage( void ) Msg( " -studiobounce #: set number of studio model radiosity bounces. default is %d\n", DEFAULT_STUDIO_BOUNCE ); Msg( " -vertexblur : blur per-vertex lighting\n" ); Msg( " -noemissive : do not add emissive textures to the lightmap\n" ); + Msg( " -skystyle # : set lightstyle for sky lighting. default is %d\n", LS_NORMAL ); #ifdef HLRAD_PARANOIA_BUMP Msg( " -gammamode # : gamma correction mode (0, 1, 2)\n" ); @@ -2925,7 +2926,12 @@ int main( int argc, char **argv ) else if( !Q_strcmp( argv[i], "-noemissive" )) { g_noemissive = true; - } + } + else if( !Q_strcmp( argv[i], "-skystyle" )) + { + g_skystyle = atoi( argv[i+1] ); + i++; + } else if( !Q_strcmp( argv[i], "-chop" )) { g_chop = (float)atof( argv[i+1] ); diff --git a/utils/pxrad/qrad.h b/utils/pxrad/qrad.h index 49030b31..bcbd25a4 100644 --- a/utils/pxrad/qrad.h +++ b/utils/pxrad/qrad.h @@ -436,6 +436,7 @@ extern int g_studiogipasscounter; extern vec3_t *g_studioskynormals; extern int g_numstudioskynormals; extern bool g_noemissive; +extern int g_skystyle; // // ambientcube.c diff --git a/utils/pxrad/vertexlight.cpp b/utils/pxrad/vertexlight.cpp index b47c65bb..a8b6f93d 100644 --- a/utils/pxrad/vertexlight.cpp +++ b/utils/pxrad/vertexlight.cpp @@ -356,12 +356,12 @@ void VertexPatchLights( int indexnum, int threadnum = -1 ) continue; for( lightstyles = 0; lightstyles < MAXLIGHTMAPS && newstyles[lightstyles] != 255; lightstyles++ ) - if( newstyles[lightstyles] == LS_NORMAL ) + if( newstyles[lightstyles] == g_skystyle ) break; if( lightstyles == MAXLIGHTMAPS ) // overflowed continue; else if( newstyles[lightstyles] == 255 ) - newstyles[lightstyles] = LS_NORMAL; + newstyles[lightstyles] = g_skystyle; GetSkyColor( skynormals[j], temp_color );