[x] add a flatten float property to CElementEmissionProfile similar to normalizeEnergy, with valid values in the [0,1) range... a straight up 1.0 would mean no IES profile so its not valid.
How flatten is supposed to work
Basically we might want to make the IES profile slightly more emissive in angles where its "dim" to simulate dispersion through light fixtures and milky diffusers, such that the light emitter doesn't appear "too dark" to an observer outside the main cone.
This means we only have two options to modify the profile, because we want some minimal energy in each direction:
orig<K ? (orig>0 ? C:0):orig minimal emission C
C*b+orig*(1-b)
Further constraint is that the IES shoudln't emit light in the directions it didn't before, so whenever original(dir)==0 then modified(dir)==0 this is to ensure we don't turn hemispherical profiles into spherical, etc.
This "modification" shouldn't affect the overall energy outputted by an IES so:
Integral ModifiedProfile === Integral OriginalProfile
The last constraint complicates things for the first choice as we have to make sure that
Integral_{Domain where 0<orig<K} C dOmega == Integral_{Domain where 0<orig<K} orig(omega) dOmega
so basically C needs to equal the average emission over the domain where original emission was greater than 0 but less than K
The whole purpose was to make sure that the emitter is at least C bright to an observer outside the cone, however because C will be an average over the solid angles where orig<K we know that C<K
Basically to find out what K should be given C we would need to have a histogram of emission values weighted by their solid angle, then iterate through it until the average of entries before the iterators reaches C. However this introduces a problem because histogram of an interpolated IES is continuous, which would lead us to needing to resort to doing a bisection search with each step involving an integral. Furthermore this clamp cannot be modelled by any physical process.
The second option is better, because then we have
Integral_{Domain where orig>0} C*b+orig*(1-b) dOmega == Integral_{Sphere} orig dOmega
where we already know the RHS (TotalEnergy) as we store it in the metadata. Also
Description
Testing
TODO list:
flatten
float property toCElementEmissionProfile
similar tonormalizeEnergy
, with valid values in the[0,1)
range... a straight up 1.0 would mean no IES profile so its not valid.How
flatten
is supposed to workBasically we might want to make the IES profile slightly more emissive in angles where its "dim" to simulate dispersion through light fixtures and milky diffusers, such that the light emitter doesn't appear "too dark" to an observer outside the main cone.
This means we only have two options to modify the profile, because we want some minimal energy in each direction:
orig<K ? (orig>0 ? C:0):orig
minimal emissionC
C*b+orig*(1-b)
Further constraint is that the IES shoudln't emit light in the directions it didn't before, so whenever
original(dir)==0
thenmodified(dir)==0
this is to ensure we don't turn hemispherical profiles into spherical, etc.This "modification" shouldn't affect the overall energy outputted by an IES so:
The last constraint complicates things for the first choice as we have to make sure that
so basically C needs to equal the average emission over the domain where original emission was greater than 0 but less than
K
The whole purpose was to make sure that the emitter is at least
C
bright to an observer outside the cone, however becauseC
will be an average over the solid angles whereorig<K
we know thatC<K
Basically to find out what
K
should be givenC
we would need to have a histogram of emission values weighted by their solid angle, then iterate through it until the average of entries before the iterators reachesC
. However this introduces a problem because histogram of an interpolated IES is continuous, which would lead us to needing to resort to doing a bisection search with each step involving an integral. Furthermore thisclamp
cannot be modelled by any physical process.The second option is better, because then we have
where we already know the RHS (TotalEnergy) as we store it in the metadata. Also
So then we have
and
which just-so happens to be the "true average" emission.
Therefore
flatten
must be a blend between the original IES image and its average value.