de.grogra.rgg
public class FluxLightModel extends LightModelBase
setRayCount(int).
The user can also specify a maximum variance for some given power quantum using setTargetVariance(double, double).
The simulation will compute the appropriate sample count to achieve the target variance.
Note that this sample count is an overestimation. The light model will select the minimum of both methods as the actual sample count.setEnableSensors(boolean).
The user may specify a maximum path depth to limit the duration of the simulation using setDepth(int).
When a simulated photon is almost completely absorbed, further simulation adds little value.
Therefore, the user can specify a cutoff power using setCutoffPower(double);
As soon as the photon power drops below this threshold, the photon is killed off. #lm.setMeasureMode. setSpectralDomain(int, int) and the discretization resolution using setSpectralBuckets(int).
The user may also supply a continuous spectral importance curve. The curve indicates importance and is used for importance sampling over the continuous spectral domain.
Regions of high importance will receive more samples and get a more accurate estimate.
The spectral importance curve applies to both the discretized measurement mode and the weighted integral mode discussed next. The curve is defined continuously over the whole spectral domain, even though in discrete spectral mode the measured spectra themselves are not continuous.
In the following example, the spectral importance curve shows a peak around 500 nm, resulting in improved measuring accuracy around this wavelength.
Note that the importance curve does not alter the expected outcome of the simulation, only the distribution of variance over the spectral domain.setSpectralDomain(int, int) and the weight functions using setSpectralWeightCurves(de.grogra.imp3d.spectral.SpectralCurve[]).
The user may again specify a spectral importance function.
Note however that in weighted integration mode the light model already uses the weight functions for spectral importance sampling. compute(). By default, first the scene is built after which the light distribution is computed. LightModelBase.getAbsorbedPower3d(de.grogra.graph.impl.Node) and LightModelBase.getSensedIrradiance3d(de.grogra.graph.impl.Node).
The user can also get a handle to the corresponding Experiment objects using getAbsorbedPower(de.grogra.graph.impl.Node) and getSensedIrradiance(de.grogra.graph.impl.Node), which contains a mapping from objects to measurements.
Multiple experiment objects can be aggregated into one experiment. The following code computes the total absorbed power over the course of one day.
All static light sources are simulated only once while the contribution of the sun between 4:00 and 22:00 is integrated using the midpoint rule with time steps of 1 hour.
The simulations are aggregated into a single experiment, containing the measured data for one whole day. | Modifier and Type | Class and Description |
|---|---|
static class |
FluxLightModel.Type |
| Modifier and Type | Field and Description |
|---|---|
static FluxLightModel.Type |
$TYPE |
static SCOType.Field |
processor$FIELD |
| Constructor and Description |
|---|
FluxLightModel()
Creates a default light model with 30.000 rays per computation
and a ray depth of 10.
|
FluxLightModel(int sampleCount,
int depth)
Creates a light model
|
FluxLightModel(int sampleCount,
int depth,
double cutoffPower)
Creates a light model
|
FluxLightModel(int sampleCount,
int depth,
double cutoffPower,
boolean enableSensors)
Creates a light model
|
| Modifier and Type | Method and Description |
|---|---|
void |
build()
Rebuild the scene
|
void |
compute()
Compute the light distribution
|
void |
compute(boolean forceCompute)
Compute the light distribution
|
void |
compute(boolean forceCompute,
boolean forceBuild)
(Re-)computes the light distribution in the current graph.
|
void |
compute(Spectrum spectrumFactory)
(Re-)computes the light distribution in the current graph.
|
void |
compute(Spectrum spectrumFactory,
boolean force)
(Re-)computes the light distribution in the current graph.
|
Experiment |
getAbsorbedPower()
Returns the experiment data on absorbed power, computed during the last call to
compute() |
Spectrum |
getAbsorbedPower(Node node)
Returns the radiant power in Watts which is absorbed by the surface
of the volume of the given
node. |
Measurement |
getAbsorbedPowerMeasurement(Node node)
Returns the power absorbed by a node during the last call to
compute() |
double |
getCutoffPower() |
int |
getDepth() |
ManageableType |
getManageableType() |
int |
getMaxLambda() |
FluxLightModelTracer.MeasureMode |
getMeasureMode() |
int |
getMinLambda() |
int |
getRandomSeed() |
int |
getRayCount() |
Experiment |
getSensedIrradiance()
Returns the experiment data on sensed irradiance, computed during the last call to
compute() |
Spectrum |
getSensedIrradiance(Node node)
Returns the irradiance in Watts per square meter which is sensed by the
sensor attached to the volume of the given
node. |
Measurement |
getSensedIrradianceMeasurement(Node node)
Returns the irradiance sensed by a node during the last call to
compute() |
int |
getSpectralBuckets() |
SpectralCurve |
getSpectralImportanceCurve() |
SpectralCurve[] |
getSpectralWeightCurve() |
boolean |
isSensorsEnabled() |
void |
setCutoffPower(double minPower)
Sets the maximum neglectable power quantum
|
void |
setDepth(int depth)
Sets the maximum ray depth per sample
|
void |
setDispersion(boolean dispersion)
Enables dispersion
|
void |
setEnableSensors(boolean enableSensors)
Enables the simulation of sensor
|
void |
setFlatness(float flatness)
Sets the tessellation flatness for polygonizable objects
|
void |
setLayerVisible(int layer,
boolean visible)
sets the visibility of a layer
|
void |
setMeasureMode(FluxLightModelTracer.MeasureMode measureMode)
Sets the current measurement mode.
|
void |
setMeasureObjectFilter(ObjectFilter measureObjectFilter)
Sets the object filter for filtering measurable objects.
|
void |
setRandomseed(int seed)
Sets the random seed for the random number generator
|
void |
setRandomSeed(int value)
sets the random seed
|
void |
setRayCount(int sampleCount)
Sets the maximum sample count per simulation
|
void |
setSeed(int value)
sets the random seed
|
void |
setSpectralBuckets(int spectralBuckets)
Sets the spectrum discretization resolution in buckets.
|
void |
setSpectralDomain(int minLambda,
int maxLambda)
Sets the simulated spectral domain.
|
void |
setSpectralImportanceCurve(SpectralCurve importanceCurve)
Sets the spectral importance function, used for spectral importance sampling.
|
void |
setSpectralWeightCurves(SpectralCurve[] weightCurves)
Sets the spectral weight functions
|
void |
setTargetVariance(double minPower,
double targetVariance)
Sets the required maximum target variance for some minimum measurable power quantum.
|
getAbsorbedPower3d, getRadiantPower3dFor, getRadiantPowerFor, getSensedIrradiance3daddReference, appendReferencesTo, fieldModified, getProvider, getStamp, initProvider, manageableReadResolve, manageableWriteReplace, removeReferencepublic static final FluxLightModel.Type $TYPE
public static final SCOType.Field processor$FIELD
public FluxLightModel()
public FluxLightModel(int sampleCount,
int depth)
rayCount - the number of samples per computationdepth - the maximum ray depthpublic FluxLightModel(int sampleCount,
int depth,
double cutoffPower)
rayCount - the number of samples per computationdepth - the maximum ray depthcutoffPower - the maximum neglectable power quantumpublic FluxLightModel(int sampleCount,
int depth,
double cutoffPower,
boolean enableSensors)
rayCount - the number of samples per computationdepth - the maximum ray depthcutoffPower - the maximum neglectable power quantumenableSensors - sensors are simulated if truepublic void build()
public void compute()
compute in class LightModelBasepublic void compute(boolean forceCompute)
compute in class LightModelBaseforceCompute - if true forces recomputation of the light distributionpublic void compute(boolean forceCompute,
boolean forceBuild)
forceCompute - if true forces recomputation of the light distributionforceBuild - if true forces rebuilding of the scenepublic void compute(Spectrum spectrumFactory)
compute in class LightModelBasespectrumFactory - factrory for spectrum objects, not used in Flux light modelpublic void compute(Spectrum spectrumFactory, boolean force)
compute in class LightModelBasespectrumFactory - factrory for spectrum objects, not used in Flux light modelforce - if true forces recomputation of the light distributionpublic Experiment getAbsorbedPower()
compute()public Spectrum getAbsorbedPower(Node node)
LightModelBasenode. If the node
does not define a volume, the zero spectrum is returned.getAbsorbedPower in class LightModelBasenode - a node of the graphpublic Measurement getAbsorbedPowerMeasurement(Node node)
compute()node - node for which the absorbed power is returnedpublic double getCutoffPower()
public int getDepth()
public ManageableType getManageableType()
public int getMaxLambda()
public FluxLightModelTracer.MeasureMode getMeasureMode()
public int getMinLambda()
public int getRandomSeed()
public int getRayCount()
public Experiment getSensedIrradiance()
compute()public Spectrum getSensedIrradiance(Node node)
LightModelBasenode.
If the node does not define a volume with a sensor,
the zero spectrum is returned.getSensedIrradiance in class LightModelBasenode - a node of the graphpublic Measurement getSensedIrradianceMeasurement(Node node)
compute()node - node for which the absorbed power is returnedpublic int getSpectralBuckets()
public SpectralCurve getSpectralImportanceCurve()
public SpectralCurve[] getSpectralWeightCurve()
public boolean isSensorsEnabled()
public void setCutoffPower(double minPower)
minPower - maximum neglectable power quantumpublic void setDepth(int depth)
depth - maximum ray depth per samplepublic void setDispersion(boolean dispersion)
dispersion - true enables dispersionpublic void setEnableSensors(boolean enableSensors)
enableSensors - true enables the sensorspublic void setFlatness(float flatness)
flatness - positive flatness parameter with 0 being infinite tessellation.public void setLayerVisible(int layer,
boolean visible)
LightModelBasesetLayerVisible in class LightModelBasepublic void setMeasureMode(FluxLightModelTracer.MeasureMode measureMode)
setSpectralDomain(int, int). The spectral resolution is specified using
INTEGRATED_SPECTRUM: Measure weighted spectral integrals, specified using setSpectralWeightCurves(de.grogra.imp3d.spectral.SpectralCurve[])
RGB: Measure RGB values
Spectral dispersion only applies to FULL_SPECTRUM and INTEGRATED_SPECTRUM and may be enabled using setDispersion(boolean)measureMode - measurement modepublic void setMeasureObjectFilter(ObjectFilter measureObjectFilter)
measureObjectFilter - Object filterpublic void setRandomseed(int seed)
seed - public void setRandomSeed(int value)
public void setRayCount(int sampleCount)
sampleCount - maximum sample countpublic void setSeed(int value)
public void setSpectralBuckets(int spectralBuckets)
spectralBuckets - bucket resolutionpublic void setSpectralDomain(int minLambda,
int maxLambda)
minLambda - lower boundary wavelengthmaxLambda - upper boundary wavelengthpublic void setSpectralImportanceCurve(SpectralCurve importanceCurve)
importanceCurve - spectral importance functionspublic void setSpectralWeightCurves(SpectralCurve[] weightCurves)
weightCurves - array of spectral weight functionspublic void setTargetVariance(double minPower,
double targetVariance)
compute(), the simulation computes the minimum number of samples required
to achieve the maximum target variance #targetVariance on any measurement of at least #minPower for the given scene.minPower - minimal measurable power quantumtargetVariance - maximum target variance