Say that someone for no reason at all creates an entity with classname light and _sun 1, delay 5, and _deviance 5 for example, which makes no sense as formula has no impact on sunlight, then the sun will be much more dim than its value dictates due to:
A sun is divided by sun samples and jittered here:
|
/* set photons */ |
|
light /= sun_num_samples; |
|
|
|
for (i = 0; i < sun_num_samples; i++) { |
|
qvec3f direction; |
Thus not jittered here:
|
static void JitterEntity(const light_t &entity) |
|
{ |
|
// don't jitter suns |
|
if (entity.sun.value()) { |
|
return; |
|
} |
And then divided again here, this time by _samples, as it had delay set to something other than 0:
|
/* For most formulas, we need to divide the light value by the number of |
|
samples (jittering) to keep the brightness approximately the same. */ |
|
if (entity->getFormula() == LF_INVERSE || entity->getFormula() == LF_INVERSE2 || |
|
entity->getFormula() == LF_INFINITE || (entity->getFormula() == LF_LOCALMIN && cfg.addminlight.value()) || |
|
entity->getFormula() == LF_INVERSE2A) { |
|
entity->light.set_value(entity->light.value() / entity->samples.value(), settings::source::MAP); |
|
} |
Unless I'm mistaken that CheckEntityFields condition ought to have a && !entity->sun.value(), and perhaps not a bad idea to emit a warning if a _sun 1 entity has delay set?
Say that someone for no reason at all creates an entity with classname
lightand_sun 1,delay 5, and_deviance 5for example, which makes no sense as formula has no impact on sunlight, then the sun will be much more dim than itsvaluedictates due to:A sun is divided by sun samples and jittered here:
ericw-tools/light/entities.cc
Lines 457 to 461 in f80b1e2
Thus not jittered here:
ericw-tools/light/entities.cc
Lines 683 to 688 in f80b1e2
And then divided again here, this time by
_samples, as it haddelayset to something other than 0:ericw-tools/light/entities.cc
Lines 354 to 360 in f80b1e2
Unless I'm mistaken that
CheckEntityFieldscondition ought to have a&& !entity->sun.value(), and perhaps not a bad idea to emit a warning if a_sun 1entity hasdelayset?