java.lang.Object
de.grogra.persistence.ShareableBase
de.grogra.rgg.LightModelBase
de.grogra.rgg.LightModel
- All Implemented Interfaces:
VolumeListener
,Manageable
,Shareable
,Options
- Direct Known Subclasses:
LightModelD
This light model generates light rays from the light sources in the current
scene and calculates how much light is received by any object. This
basically works like an inverse ray tracer.
The total light contribution of the light source to the scene determines how many rays are created for that light source. For instance if there were two light sources with a power of 100W and 10W and a total number of 11.000 rays, then the first light would create 10.000 rays and the second light 1.000 rays.
The total light contribution of the light source to the scene determines how many rays are created for that light source. For instance if there were two light sources with a power of 100W and 10W and a total number of 11.000 rays, then the first light would create 10.000 rays and the second light 1.000 rays.
- Author:
- Reinhard Hemmerling
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LightModel.Type
protected int
Maximum recursion depthstatic final SCOType.Field
protected double
Minimum power for a ray to continue recursionstatic final SCOType.Field
protected RadiationModel
protected int
The number of rays that is cast from light sources each time compute() is called.static final SCOType.Field
protected long
The seed for the pseudorandom generator.static final SCOType.Field
protected Spectrum
The spectrum factory.static final SCOType.Field
protected int
static final SCOType.Field
protected boolean[]
static final SCOType.Field
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a default light model with 30.000 rays per computation and a ray depth of 10.LightModel
(int rayCount, int depth) LightModel
(int rayCount, int depth, double minPower) -
Method Summary
Modifier and TypeMethodDescriptionvoid
beginGroup
(Object object, boolean asNode) This method is invoked by aSceneVisitor
when subsequent volumes shall be grouped into a single compound object.protected int
checkVolumeId
(Node node) void
compute()
(Re-)computes the light distribution in the current graph.void
compute
(boolean force) (Re-)computes the light distribution in the current graph.void
compute
(boolean force, boolean collectTracedRays) void
(Re-)computes the light distribution in the current graph.void
(Re-)computes the light distribution in the current graph.void
(Re-)computes the light distribution in the current graph.void
endGroup()
This method is invoked by aSceneVisitor
when the current group ends.Returns the option value for the option identified bykey
.getAbsorbedPower
(Node node) Returns the radiant power in Watts which is absorbed by the surface of the volume of the givennode
.int
getDepth()
int
getHitCount
(Node node) Returns the number of rays which is hit the surface of the volume of the givennode
.double
int
getReceivedPower
(Node node) Returns the radiant power in Watts which is received by the surface of the volume of the givennode
.getReflectedPower
(Node node) Returns the radiant power in Watts which is reflected by the surface of the volume of the givennode
.long
getSeed()
getSensedIrradiance
(Node node) Returns the irradiance in Watts per square meter which is sensed by the sensor attached to the volume of the givennode
.int
getTransmittedPower
(Node node) Returns the radiant power in Watts which is transmitted by the surface of the volume of the givennode
.boolean
void
This invalidates the octree of the SceneVisitor and forces a complete new computation.protected static void
void
setDepth
(int depth) void
setLayerVisible
(int layer, boolean visible) sets the visibility of a layervoid
setMinPower
(double minPower) void
setRayCount
(int rayCount) void
setSeed
(long value) void
setSpectrumFactory
(Spectrum value) void
setThreadCount
(int value) void
volumeCreated
(Object object, boolean asNode, Volume volume) This method is invoked by aSceneVisitor
when avolume
is created as representation of the geometry ofobject
.Methods inherited from class de.grogra.rgg.LightModelBase
getAbsorbedPower3d, getRadiantPower3dFor, getRadiantPowerFor, getSensedIrradiance3d
Methods inherited from class de.grogra.persistence.ShareableBase
addReference, appendReferencesTo, fieldModified, getProvider, getStamp, initProvider, manageableReadResolve, manageableWriteReplace, removeReference
-
Field Details
-
processor
-
rayCount
protected int rayCountThe number of rays that is cast from light sources each time compute() is called. -
depth
protected int depthMaximum recursion depth -
minPower
protected double minPowerMinimum power for a ray to continue recursion -
seed
protected long seedThe seed for the pseudorandom generator. -
threadCount
protected int threadCount -
spectrumFactory
The spectrum factory. This defines the type of spectra on which the light model will perform its computations. -
visibleLayers
protected boolean[] visibleLayers -
$TYPE
-
rayCount$FIELD
-
depth$FIELD
-
minPower$FIELD
-
seed$FIELD
-
threadCount$FIELD
-
spectrumFactory$FIELD
-
visibleLayers$FIELD
-
-
Constructor Details
-
LightModel
public LightModel()Create a default light model with 30.000 rays per computation and a ray depth of 10. -
LightModel
public LightModel(int rayCount, int depth) -
LightModel
public LightModel(int rayCount, int depth, double minPower)
-
-
Method Details
-
compute
public void compute()Description copied from class:LightModelBase
(Re-)computes the light distribution in the current graph.- Specified by:
compute
in classLightModelBase
-
compute
Description copied from class:LightModelBase
(Re-)computes the light distribution in the current graph.- Specified by:
compute
in classLightModelBase
- Parameters:
spectrumFactory
- factrory for spectrum objects
-
compute
public void compute(boolean force) Description copied from class:LightModelBase
(Re-)computes the light distribution in the current graph.- Specified by:
compute
in classLightModelBase
- Parameters:
force
- if true forces recomputation of the light distribution
-
compute
public void compute(boolean force, boolean collectTracedRays) -
compute
(Re-)computes the light distribution in the current graph. This method has to be invoked at first in order forLightModelBase.getRadiantPowerFor(de.grogra.graph.impl.Node)
to return correct values.- Specified by:
compute
in classLightModelBase
- Parameters:
force
- if true forces recomputation of the light distributionspectrumFactory
- factrory for spectrum objects
-
compute
(Re-)computes the light distribution in the current graph. This method has to be invoked at first in order forLightModelBase.getRadiantPowerFor(de.grogra.graph.impl.Node)
to return correct values.- Parameters:
force
- if true forces recomputation of the light distributioncollectTracedRays
- if true the traced rays are collected and can be obtained by {}. This can be used for debugging purposes.
-
setDepth
public void setDepth(int depth) -
setRayCount
public void setRayCount(int rayCount) -
setMinPower
public void setMinPower(double minPower) -
setLayerVisible
public void setLayerVisible(int layer, boolean visible) Description copied from class:LightModelBase
sets the visibility of a layer- Specified by:
setLayerVisible
in classLightModelBase
-
hasResults
public boolean hasResults() -
print
-
checkVolumeId
-
getHitCount
Returns the number of rays which is hit the surface of the volume of the givennode
. If thenode
does not define a volume, the zero is returned.- Parameters:
node
- a node of the graph- Returns:
- the number of rays which is hit the node
-
getTransmittedPower
Returns the radiant power in Watts which is transmitted by the surface of the volume of the givennode
. If thenode
does not define a volume, the zero spectrum is returned.- Parameters:
node
- a node of the graph- Returns:
- the transmitted radiant power of the node
-
getReflectedPower
Returns the radiant power in Watts which is reflected by the surface of the volume of the givennode
. If thenode
does not define a volume, the zero spectrum is returned.- Parameters:
node
- a node of the graph- Returns:
- the reflected radiant power of the node
-
getReceivedPower
Returns the radiant power in Watts which is received by the surface of the volume of the givennode
. If thenode
does not define a volume, the zero spectrum is returned.- Parameters:
node
- a node of the graph- Returns:
- the received radiant power of the node
-
getAbsorbedPower
Returns the radiant power in Watts which is absorbed by the surface of the volume of the givennode
. If thenode
does not define a volume, the zero spectrum is returned.- Specified by:
getAbsorbedPower
in classLightModelBase
- Parameters:
node
- a node of the graph- Returns:
- the absorbed radiant power of the node
-
getSensedIrradiance
Returns the irradiance in Watts per square meter which is sensed by the sensor attached to the volume of the givennode
. If thenode
does not define a volume with a sensor, the zero spectrum is returned.- Specified by:
getSensedIrradiance
in classLightModelBase
- Parameters:
node
- a node of the graph- Returns:
- the sensed irradiance of the node
-
getSensedIrradianceCollector
-
getAbsorbedPowerCollector
-
getTracedRays
-
get
Description copied from interface:Options
Returns the option value for the option identified bykey
. If no special value for the option is defined,defaultValue
is returned. -
volumeCreated
Description copied from interface:VolumeListener
This method is invoked by aSceneVisitor
when avolume
is created as representation of the geometry ofobject
. By storing the information provided by the parameters, the link from graph objects (nodes and edges) to volumes can be established.- Specified by:
volumeCreated
in interfaceVolumeListener
- Parameters:
object
- an object of the graphasNode
- isobject
a node or an edge?volume
- the volume which has been created as geometrical representation ofobject
-
beginGroup
Description copied from interface:VolumeListener
This method is invoked by aSceneVisitor
when subsequent volumes shall be grouped into a single compound object. The group extends until the corresponding invocation ofVolumeListener.endGroup()
. These invocations may be nested, i.e., there may be groups within groups.Each group starts at
object
in the graph. Ifobject
has a geometric representation itself, the corresponding invocation ofVolumeListener.volumeCreated(java.lang.Object, boolean, de.grogra.vecmath.geom.Volume)
may be either immediately before of afterbeginGroup
.- Specified by:
beginGroup
in interfaceVolumeListener
- Parameters:
object
- the object of the graph which represents the root of the groupasNode
- isobject
a node or an edge?- See Also:
-
endGroup
public void endGroup()Description copied from interface:VolumeListener
This method is invoked by aSceneVisitor
when the current group ends.- Specified by:
endGroup
in interfaceVolumeListener
- See Also:
-
invalidateOctree
public void invalidateOctree()This invalidates the octree of the SceneVisitor and forces a complete new computation. This method is useful if you want to recompute the LightModel without any changes of the scene. -
getManageableType
- Specified by:
getManageableType
in interfaceManageable
-
getRayCount
public int getRayCount() -
getDepth
public int getDepth() -
getThreadCount
public int getThreadCount() -
setThreadCount
public void setThreadCount(int value) -
getSeed
public long getSeed() -
setSeed
public void setSeed(long value) -
getMinPower
public double getMinPower() -
getSpectrumFactory
-
setSpectrumFactory
-