cvar_t r_shadow_bouncegrid_particleintensity = {CVAR_SAVE, "r_shadow_bouncegrid_particleintensity", "0.25", "brightness of particles contributing to bouncegrid texture"};
cvar_t r_shadow_bouncegrid_sortlightpaths = {CVAR_SAVE, "r_shadow_bouncegrid_sortlightpaths", "1", "sort light paths before accumulating them into the bouncegrid texture, this reduces cpu cache misses"};
cvar_t r_shadow_bouncegrid_lightpathsize = {CVAR_SAVE, "r_shadow_bouncegrid_lightpathsize", "1", "width of the light path for accumulation of light in the bouncegrid texture"};
cvar_t r_shadow_bouncegrid_particleintensity = {CVAR_SAVE, "r_shadow_bouncegrid_particleintensity", "0.25", "brightness of particles contributing to bouncegrid texture"};
cvar_t r_shadow_bouncegrid_sortlightpaths = {CVAR_SAVE, "r_shadow_bouncegrid_sortlightpaths", "1", "sort light paths before accumulating them into the bouncegrid texture, this reduces cpu cache misses"};
cvar_t r_shadow_bouncegrid_lightpathsize = {CVAR_SAVE, "r_shadow_bouncegrid_lightpathsize", "1", "width of the light path for accumulation of light in the bouncegrid texture"};
cvar_t r_shadow_bouncegrid_static = {CVAR_SAVE, "r_shadow_bouncegrid_static", "1", "use static radiosity solution (high quality) rather than dynamic (splotchy)"};
cvar_t r_shadow_bouncegrid_static_bounceminimumintensity = { CVAR_SAVE, "r_shadow_bouncegrid_static_bounceminimumintensity", "0.01", "stop bouncing once intensity drops below this fraction of the original particle color" };
cvar_t r_shadow_bouncegrid_static_directionalshading = {CVAR_SAVE, "r_shadow_bouncegrid_static_directionalshading", "1", "whether to use directionalshading when in static mode"};
cvar_t r_shadow_bouncegrid_static = {CVAR_SAVE, "r_shadow_bouncegrid_static", "1", "use static radiosity solution (high quality) rather than dynamic (splotchy)"};
cvar_t r_shadow_bouncegrid_static_bounceminimumintensity = { CVAR_SAVE, "r_shadow_bouncegrid_static_bounceminimumintensity", "0.01", "stop bouncing once intensity drops below this fraction of the original particle color" };
cvar_t r_shadow_bouncegrid_static_directionalshading = {CVAR_SAVE, "r_shadow_bouncegrid_static_directionalshading", "1", "whether to use directionalshading when in static mode"};
Cvar_RegisterVariable(&r_shadow_bouncegrid_includedirectlighting);
Cvar_RegisterVariable(&r_shadow_bouncegrid_intensity);
Cvar_RegisterVariable(&r_shadow_bouncegrid_lightpathsize);
Cvar_RegisterVariable(&r_shadow_bouncegrid_includedirectlighting);
Cvar_RegisterVariable(&r_shadow_bouncegrid_intensity);
Cvar_RegisterVariable(&r_shadow_bouncegrid_lightpathsize);
Cvar_RegisterVariable(&r_shadow_bouncegrid_particlebounceintensity);
Cvar_RegisterVariable(&r_shadow_bouncegrid_particleintensity);
Cvar_RegisterVariable(&r_shadow_bouncegrid_sortlightpaths);
Cvar_RegisterVariable(&r_shadow_bouncegrid_particlebounceintensity);
Cvar_RegisterVariable(&r_shadow_bouncegrid_particleintensity);
Cvar_RegisterVariable(&r_shadow_bouncegrid_sortlightpaths);
settings->spacing[0] = spacing;
settings->spacing[1] = spacing;
settings->spacing[2] = spacing;
settings->spacing[0] = spacing;
settings->spacing[1] = spacing;
settings->spacing[2] = spacing;
// bound the values for sanity
settings->maxphotons = bound(1, settings->maxphotons, 25000000);
// bound the values for sanity
settings->maxphotons = bound(1, settings->maxphotons, 25000000);
if (R_CullBox(cullmins, cullmaxs))
continue;
if (r_refdef.scene.worldmodel
if (R_CullBox(cullmins, cullmaxs))
continue;
if (r_refdef.scene.worldmodel
- && r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs
- && !r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.scene.worldmodel, r_refdef.viewcache.world_leafvisible, cullmins, cullmaxs))
+ && r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs
+ && !r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.scene.worldmodel, r_refdef.viewcache.world_leafvisible, cullmins, cullmaxs))
w *= ((rtlight->style >= 0 && rtlight->style < MAX_LIGHTSTYLES) ? r_refdef.scene.rtlightstylevalue[rtlight->style] : 1);
VectorScale(rtlight->color, w, rtlight->bouncegrid_photoncolor);
// skip lights that will emit no photons
w *= ((rtlight->style >= 0 && rtlight->style < MAX_LIGHTSTYLES) ? r_refdef.scene.rtlightstylevalue[rtlight->style] : 1);
VectorScale(rtlight->color, w, rtlight->bouncegrid_photoncolor);
// skip lights that will emit no photons
- Math_RandomSeed_FromInt(&randomseed, seed);
+ // compute a seed for the unstable random modes
+ memset(&rseed, 0, sizeof(rseed));
+ rseed.d = realtime;
+ Math_RandomSeed_FromInts(&randomseed, rseed.s[0], rseed.s[1], rseed.s[2], rseed.s[3]);
+ seed = rseed.s[0] ^ rseed.s[1] ^ rseed.s[2] ^ rseed.s[3];
hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY;// | SUPERCONTENTS_LIQUIDSMASK;
else
hitsupercontentsmask = SUPERCONTENTS_SOLID;// | SUPERCONTENTS_LIQUIDSMASK;
hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY;// | SUPERCONTENTS_LIQUIDSMASK;
else
hitsupercontentsmask = SUPERCONTENTS_SOLID;// | SUPERCONTENTS_LIQUIDSMASK;
r_refdef.stats[r_stat_bouncegrid_particles] += shootparticles;
// we stop caring about bounces once the brightness goes below this fraction of the original intensity
bounceminimumintensity2 = VectorLength(baseshotcolor) * settings.bounceminimumintensity2;
r_refdef.stats[r_stat_bouncegrid_particles] += shootparticles;
// we stop caring about bounces once the brightness goes below this fraction of the original intensity
bounceminimumintensity2 = VectorLength(baseshotcolor) * settings.bounceminimumintensity2;
- default:
- break;
- case 1:
- Math_RandomSeed_FromInt(&randomseed, lightindex * 11937);
- // prime the random number generator a bit
- Math_crandomf(&randomseed);
- break;
- case 2:
- seed = lightindex * 11937;
- // prime the random number generator a bit
- lhcheeserand(seed);
- break;
+ union
+ {
+ unsigned int i[4];
+ float f[4];
+ }
+ u;
+ u.f[0] = rtlight->shadoworigin[0];
+ u.f[1] = rtlight->shadoworigin[1];
+ u.f[2] = rtlight->shadoworigin[2];
+ u.f[3] = 1;
+ switch (settings.stablerandom)
+ {
+ default:
+ break;
+ case 1:
+ seed = u.i[0] ^ u.i[1] ^ u.i[2] ^ u.i[3];
+ break;
+ case 2:
+ Math_RandomSeed_FromInts(&randomseed, u.i[0], u.i[1], u.i[2], u.i[3]);
+ break;
+ }
for (shotparticles = 0;shotparticles < shootparticles;shotparticles++)
{
VectorCopy(baseshotcolor, shotcolor);
for (shotparticles = 0;shotparticles < shootparticles;shotparticles++)
{
VectorCopy(baseshotcolor, shotcolor);
if (settings.bounceanglediffuse)
{
// we want random to be stable, so we still have to do all the random we would have done
for (bouncecount = 0; bouncecount < maxbounce; bouncecount++)
if (settings.bounceanglediffuse)
{
// we want random to be stable, so we still have to do all the random we would have done
for (bouncecount = 0; bouncecount < maxbounce; bouncecount++)
if (settings.bounceanglediffuse)
{
// we want random to be stable, so we still have to do all the random we would have done
for (bouncecount = 0; bouncecount < maxbounce; bouncecount++)
if (settings.bounceanglediffuse)
{
// we want random to be stable, so we still have to do all the random we would have done
for (bouncecount = 0; bouncecount < maxbounce; bouncecount++)
VectorMA(clipstart, radius, clipend, clipend);
for (bouncecount = 0;;bouncecount++)
{
VectorMA(clipstart, radius, clipend, clipend);
for (bouncecount = 0;;bouncecount++)
{
- cliptrace = CL_Cache_TraceLineSurfaces(clipstart, clipend, settings.hitmodels ? MOVE_HITMODEL : MOVE_NOMONSTERS, hitsupercontentsmask, skipsupercontentsmask);
+ cliptrace = CL_Cache_TraceLineSurfaces(clipstart, clipend, settings.staticmode ? MOVE_WORLDONLY : (settings.hitmodels ? MOVE_HITMODEL : MOVE_NOMONSTERS), hitsupercontentsmask, skipsupercontentsmask);
- DrawQ_Pic(x-5, y-5, NULL, 250, 155, 0, 0, 0, 0.75, 0);
+ DrawQ_Pic(x-5, y-5, NULL, 250, 243, 0, 0, 0, 0.75, 0);