|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.graph.impl.Edge de.grogra.graph.impl.Node de.grogra.imp3d.shading.ChannelMapNode de.grogra.imp3d.shading.ColorMapNode de.grogra.imp3d.shading.Material de.grogra.imp3d.shading.SunSkyLight
public class SunSkyLight
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.grogra.graph.impl.Node |
---|
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType |
Nested classes/interfaces inherited from interface de.grogra.util.Map |
---|
Map.Chain |
Field Summary | |
---|---|
static Node.NType |
$TYPE
|
static Node.NType.Field |
disableLight$FIELD
|
static Node.NType.Field |
disableSun$FIELD
|
static Node.NType.Field |
radianceFactor$FIELD
|
static Node.NType.Field |
sun$FIELD
|
static Node.NType.Field |
turbidity$FIELD
|
Fields inherited from class de.grogra.imp3d.shading.ChannelMapNode |
---|
AMBIENT, COLOR, COLOR_2, DIFFUSE_TRANSPARENCY, DISPLACEMENT, EMISSIVE, FIRST_OP, INPUT, input$FIELD, MIN_UNUSED_SPECIAL_OF_TARGET, SECOND_OP, SHININESS, SPECULAR, TRANSPARENCY, TRANSPARENCY_SHININESS |
Fields inherited from class de.grogra.graph.impl.Node |
---|
ADDITIONAL_FIELDS, bits, DELETED, EXTENT_BIT, EXTENT_MASK, extentIndex$FIELD, extentTail$FIELD, HAS_OBSERVERS, IS_INTERPRETIVE, isInterpretive$FIELD, LAST_EXTENT_INDEX, layer$FIELD, MARK, mark$FIELD, MIME_TYPE, MIN_UNUSED_SPECIAL_OF_SOURCE, name$FIELD, USED_BITS |
Fields inherited from interface de.grogra.ray.physics.Light |
---|
AMBIENT, AREA, DIRECTIONAL, NO_LIGHT, POINT, SKY |
Fields inherited from interface de.grogra.ray.physics.Scattering |
---|
DELTA_FACTOR, IS_NON_OPAQUE, MIN_UNUSED_FLAG, NEEDS_NORMAL, NEEDS_POINT, NEEDS_TANGENTS, NEEDS_TRANSFORMATION, NEEDS_UV, RANDOM_RAYS_GENERATE_ORIGINS |
Fields inherited from interface de.grogra.ray.physics.Shader |
---|
LAMBERTIAN_VARIANCE |
Fields inherited from interface de.grogra.icon.Icon |
---|
DEFAULT, DISABLED |
Fields inherited from interface de.grogra.util.Map |
---|
DEFAULT_VALUE, EMPTY_MAP |
Constructor Summary | |
---|---|
SunSkyLight()
|
Method Summary | |
---|---|
void |
accept(ChannelMapNodeVisitor visitor)
|
void |
accept(LightVisitor visitor)
|
void |
accept(ShaderVisitor visitor)
|
double |
completeRay(Environment env,
Point3d vertex,
Ray out)
|
float |
computeBSDF(Environment env,
Vector3f in,
Spectrum specIn,
Vector3f out,
boolean adjoint,
Spectrum bsdf)
Evaluates bidirectional scattering distribution function for given input. |
double |
computeExitance(Environment env,
Spectrum exitance)
Evaluates the exitance function for given input. |
void |
computeMaxRays(Environment env,
Vector3f in,
Spectrum specIn,
Ray reflected,
Tuple3f refVariance,
Ray transmitted,
Tuple3f transVariance)
Computes, for the given input, the reflected and transmitted importance rays for which the reflection/transmission probability densities (integrated over the spectrum) attain a maximum. |
void |
generateRandomOrigins(Environment env,
RayList out,
java.util.Random random)
Pseudorandomly generates, for the given input, a set of origins for this emitter. |
void |
generateRandomRays(Environment env,
Vector3f out,
Spectrum specOut,
RayList rays,
boolean adjoint,
java.util.Random random)
Pseudorandomly generates, for the given input, a set of scattered rays. |
int |
getAverageColor()
Returns an average color for the scattering entity. |
int |
getFlags()
|
int |
getLightType()
Determines the type of light source which is represented by this light. |
protected Node.NType |
getNTypeImpl()
This method returns the Node.NType which describes the managed
fields of the class of this node. |
float |
getRadianceFactor()
|
Vector3d |
getSun()
|
double |
getTotalPower(Environment env)
Computes the total power of this light source which is emitted to the region defined by env.bounds . |
float |
getTurbidity()
|
boolean |
isDisableLight()
|
boolean |
isDisableSun()
|
boolean |
isIgnoredWhenHit()
Determines whether the light source shall be ignored when a shot ray happens to hit the geometry of the light source. |
boolean |
isShadowless()
Determines whether the light source casts shadows or not. |
boolean |
isTransparent()
|
protected Node |
newInstance()
This method returns a new instance of the class of this node. |
void |
setDisableLight(boolean value)
|
void |
setDisableSun(boolean value)
|
void |
setRadianceFactor(float value)
|
void |
setSun(Vector3d value)
|
void |
setTurbidity(float value)
|
void |
shade(Environment env,
RayList in,
Vector3f out,
Spectrum specOut,
Tuple3d color)
Computes color of outgoing light ray for given input. |
Methods inherited from class de.grogra.imp3d.shading.Material |
---|
renderLine, renderLine |
Methods inherited from class de.grogra.imp3d.shading.ColorMapNode |
---|
drawImage, getIcon, getIconBounds, getIconSource, getImage, getImage, getImageSource, getInputData, getPreferredIconSize, getRenderedImage, getSizeRatio, isMutable, paintIcon, prepareIcon, renderImage |
Methods inherited from class de.grogra.imp3d.shading.ChannelMapNode |
---|
accept, getFloatValue, getInput, getObjectValue, setInput |
Methods inherited from class de.grogra.graph.impl.Edge |
---|
addEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBits |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.grogra.math.ChannelMap |
---|
accept, getFloatValue, getObjectValue, getStamp |
Methods inherited from interface de.grogra.pf.ui.RenderedIcon |
---|
getStamp |
Methods inherited from interface de.grogra.persistence.PersistenceCapable |
---|
getBitMark, getObjectMark, setBitMark, setObjectMark |
Field Detail |
---|
public static final Node.NType $TYPE
public static final Node.NType.Field disableLight$FIELD
public static final Node.NType.Field disableSun$FIELD
public static final Node.NType.Field radianceFactor$FIELD
public static final Node.NType.Field sun$FIELD
public static final Node.NType.Field turbidity$FIELD
Constructor Detail |
---|
public SunSkyLight()
Method Detail |
---|
public void accept(ChannelMapNodeVisitor visitor)
accept
in class ChannelMapNode
public void accept(LightVisitor visitor)
public void accept(ShaderVisitor visitor)
public double completeRay(Environment env, Point3d vertex, Ray out)
completeRay
in interface Emitter
public float computeBSDF(Environment env, Vector3f in, Spectrum specIn, Vector3f out, boolean adjoint, Spectrum bsdf)
Scattering
The computed spectrum is an integral over the spectrum of the following product:
env.point
,
ωi the (negated) direction of the incoming light ray,
νi the frequency where the incoming ray is sampled,
ωo the direction of the outgoing light ray,
νo the frequency where the outgoing ray is sampled,
and θ the angle between the surface normal and out
.
If adjoint
is false
, in
and
out
describe true light rays from light sources to sensors.
In this case, ωi = in
,
ωo = out
, and the integral is
bsdf
(ν) = |cos θ| ∫ BSDF(in
, νi;
out
, ν) specIn
(νi) dνi
adjoint
is true
. in
and
out
then describe importance rays (inverse light rays
from sensors to light sources). In this case,
ωi = out
,
ωo = in
, and the integral is
bsdf
(ν) = |cos θ| ∫
BSDF(out
, ν;
in
, νo) specIn
(νo) dνo
If this Scattering
instance is in fact a
Light
source, adjoint
is false
,
and the BSDF is defined as BSDF(in
, μ; ω, ν)
= L1(ω, ν) δ(μ - ν),
i.e., the directional distribution
of the emitted radiance at env.point
, see Emitter
.
In this case, in
is not used.
If this Scattering
instance is in fact a
Sensor
, adjoint
is true
,
and the BSDF is defined as BSDF(ω, ν; in
, μ)
= W1(ω, ν) δ(μ - ν),
i.e., the directional distribution
of the emitted importance at env.point
, see Emitter
.
In this case, in
is not used.
The computation should be physically valid. This excludes, e.g., ambient or emissive light contributions.
The returned value
is the value of the probability density pω
that would be calculated by Scattering.generateRandomRays(de.grogra.ray.physics.Environment, javax.vecmath.Vector3f, de.grogra.ray.physics.Spectrum, de.grogra.ray.util.RayList, boolean, java.util.Random)
if
the ray happened to be one of the randomly generated rays.
computeBSDF
in interface Scattering
env
- the environment for scatteringin
- the (negated) direction unit vector of the incoming ray
(i.e., pointing away from the surface)specIn
- the spectrum of the incoming rayout
- the direction unit vector of the outgoing ray
(i.e., pointing away from the surface)adjoint
- light ray or importance ray?bsdf
- the computed spectrum of the outgoing ray will be placed in here
public double computeExitance(Environment env, Spectrum exitance)
Emitter
env.point
in case of light sources, or the
corresponding function W0j(x, ν) in case
of sensors.
The returned value
is the value of the probability density px
that would be calculated by Emitter.generateRandomOrigins(de.grogra.ray.physics.Environment, de.grogra.ray.util.RayList, java.util.Random)
if
env.point
happened to be one of the randomly generated
origins.
computeExitance
in interface Emitter
env
- the environment for scatteringexitance
- the exitance values will be placed in here
public void computeMaxRays(Environment env, Vector3f in, Spectrum specIn, Ray reflected, Tuple3f refVariance, Ray transmitted, Tuple3f transVariance)
Shader
in
, is
in
) / R
in
).
The transmission probability density is defined correspondingly.
The color
-fields are set to the total
reflectivity/transparency for the incident direction
for each color component R, G, B. Thus, for physically plausible
BRDF/BTDF, the component-wise sum of reflected.color
and
transmitted.color
lies in the interval [0, 1],
and the difference to 1 is the amount absorbed.
The color
may be zero if there is no reflected or transmitted ray,
respectively, i.e., if the surface is fully transparent, opaque,
or absorbing. The origin-fields of the rays will never be set.
The computed variances are defined to be, for each color component,
(approximations for) the angular mean quadratic
deviations of the densities from the returned maximal ray directions.
E.g., for perfect reflection/transmission, these variances are zero,
whereas for a perfect lambertian reflector, the variance of reflection
is ∫ cos θ (1 / π) θ2 dω
= (π2 - 4) / 8.
This is the value of Shader.LAMBERTIAN_VARIANCE
.
The ray properties which are not mentioned are neither used nor modified. These are the origin and its density, and the direction density.
computeMaxRays
in interface Shader
env
- the environment for scatteringin
- the (negated) direction unit vector of the incoming ray
(i.e., pointing away from the surface)specIn
- spectrum of incoming rayreflected
- the reflected ray with maximal probabilityrefVariance
- the angular mean quadratic deviation from reflected
transmitted
- the transmitted ray with maximal probabilitytransVariance
- the angular mean quadratic deviation from transmitted
public void generateRandomOrigins(Environment env, RayList out, java.util.Random random)
Emitter
At first, we consider the case where the emitter is in fact a light source. Let L(x, ω, ν) be the emitted spectral radiance for the frequency ν at the light's surface point x in direction ω. The radiant exitance (emitted spectral power per area) at x is defined as
rays.size
). Then
for a function f(x, ν) which is to be
integrated over the light surface, the sum
Now if the emitter is a sensor, let W(x, ω, ν) be the emitted spectral importance for frequency ν at the sensors's surface point x in direction ω. The quantities W0(x, ν) and W1(x, ω, ν) are defined similarly to the case of light sources:
Let px be the probability density used for the ray
origin, then the field originDensity
is set to px(oi) for each ray.
For emitters which are concentrated at a single point
(e.g., point lights) px is not
a regular function, the value originDensity
will
be set to a multiple of Scattering.DELTA_FACTOR
.
The ray properties which are not mentioned in the given formulas are neither used nor modified. These are the direction and its density.
generateRandomOrigins
in interface Emitter
env
- the environmentout
- the outgoing rays to be generatedrandom
- pseudorandom generatorpublic void generateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean adjoint, java.util.Random random)
Scattering
adjoint
is false
,
out
= ωo describes
the direction of an outgoing light ray.
In this case, the integration is with respect to ωi.
Let g(ω, ν; out
, μ)
= BSDF(ω, ν; out
, μ)
adjoint
is true
. In this case,
out
= ωi describes
the direction of an outgoing importance ray (an inverse light ray).
Now the integration is with respect to ωo.
Let g(ω, ν; out
, μ)
= BSDF(out
, μ; ω, ν)
rays.size
). Then, for every
frequency ν the sum
out
, μ)
specOut
(μ) dμ dω
If this Scattering
instance is in fact a
Light
source, adjoint
is true
,
and the BSDF is defined as BSDF(out
, μ; ω, ν)
= L1(ω, ν) δ(μ - ν),
i.e., the directional distribution
of the emitted radiance at env.point
, see Emitter
.
In this case, out
is not used.
If this Scattering
instance is in fact a
Sensor
, adjoint
is false
,
and the BSDF is defined as BSDF(ω, ν; out
, μ)
= W1(ω, ν) δ(μ - ν),
i.e., the directional distribution
of the emitted importance at env.point
, see Emitter
.
In this case, out
is not used.
Let pω be the probability density
used for the ray direction (measured with respect to
solid angle ω),
then the field directionDensity
of the ray i
is set to pω(di).
For ideal specular reflection or transmission, or for directional
lights or sensors, pω is not
a regular function, the value directionDensity
will
be set to a multiple of Scattering.DELTA_FACTOR
.
The ray properties which are not mentioned in the given formulas are neither used nor modified. These are the origin and its density.
generateRandomRays
in interface Scattering
env
- the environment for scatteringout
- the direction unit vector of the outgoing ray
(i.e., pointing away from the surface)specOut
- the spectrum of the outgoing rayrays
- the rays to be generatedadjoint
- represents out
a light ray or an importance ray?random
- pseudorandom generatorScattering.computeBSDF(de.grogra.ray.physics.Environment, javax.vecmath.Vector3f, de.grogra.ray.physics.Spectrum, javax.vecmath.Vector3f, boolean, de.grogra.ray.physics.Spectrum)
public int getAverageColor()
Scattering
getAverageColor
in interface ColorMap
getAverageColor
in interface Scattering
public int getFlags()
getFlags
in interface Scattering
public int getLightType()
Light
getLightType
in interface Light
Light.NO_LIGHT
, Light.POINT
, Light.AREA
,
Light.DIRECTIONAL
, Light.SKY
, Light.AMBIENT
.protected Node.NType getNTypeImpl()
Node
Node.NType
which describes the managed
fields of the class of this node. This method has to be implemented
in every concrete subclass.
getNTypeImpl
in class Node
public float getRadianceFactor()
public Vector3d getSun()
public double getTotalPower(Environment env)
Light
env.bounds
. Note that the computed
value is not necessarily exact: It should be used just as a hint, e.g.,
when one of a set of lights has to be chosen randomly on the basis of
their relative power.
getTotalPower
in interface Light
env
- environment which defines the bounds of the scene
env.bounds
public float getTurbidity()
public boolean isDisableLight()
public boolean isDisableSun()
public boolean isIgnoredWhenHit()
Light
isIgnoredWhenHit
in interface Light
true
iff the light source shall be ignoredpublic boolean isShadowless()
Light
isShadowless
in interface Light
true
iff the light source does not cast shadowspublic boolean isTransparent()
isTransparent
in interface Shader
protected Node newInstance()
Node
newInstance
in class Node
public void setDisableLight(boolean value)
public void setDisableSun(boolean value)
public void setRadianceFactor(float value)
public void setSun(Vector3d value)
public void setTurbidity(float value)
public void shade(Environment env, RayList in, Vector3f out, Spectrum specOut, Tuple3d color)
Shader
out
) ck,j
env.point
,
ωk and ck the direction and color of ray k,
and θk the angle between the surface normal
and ωk.
The computation may include physically invalid contributions, which may not fit into the formula above, e.g., ambient or emissive light contributions.
shade
in interface Shader
env
- the environment for scatteringin
- the incoming raysout
- the direction unit vector of the outgoing ray
(i.e., pointing away from the surface)specOut
- spectrum of outgoing raycolor
- the output color will be placed in here
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |