de.grogra.imp3d.objects
public class Parallelogram extends Axis implements Pickable, Renderable, Light, Raytraceable
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType| Modifier and Type | Field and Description |
|---|---|
static Node.NType |
$TYPE |
static Node.NType.Field |
axis$FIELD |
protected AreaLight |
light |
static Node.NType.Field |
light$FIELD |
endPosition, endPosition$FIELD, length, length$FIELD, startPosition, startPosition$FIELDSCALE_V_MASK, scaleV$FIELD, USED_BITSINFINITE_MASK, interior, interior$FIELD, shader, shader$FIELD, treatedAsInfinite$FIELDtransform, transform$FIELD, TRANSFORMING_MASK, transforming$FIELDADDITIONAL_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, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELDAMBIENT, AREA, DIRECTIONAL, NO_LIGHT, POINT, SKYDELTA_FACTOR, IS_NON_OPAQUE, MIN_UNUSED_FLAG, NEEDS_NORMAL, NEEDS_POINT, NEEDS_TANGENTS, NEEDS_TRANSFORMATION, NEEDS_UV, RANDOM_RAYS_GENERATE_ORIGINSDEFAULT_VALUE, EMPTY_MAP| Constructor and Description |
|---|
Parallelogram() |
Parallelogram(float length,
float width) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(LightVisitor visitor) |
double |
completeRay(Environment env,
Point3d vertex,
Ray out) |
float |
computeBSDF(Environment env,
Vector3f in,
Spectrum specIn,
Vector3f out,
boolean photon,
Spectrum bsdf)
Evaluates bidirectional scattering distribution function for given input.
|
double |
computeExitance(Environment env,
Spectrum exitance)
Evaluates the exitance function for given input.
|
RaytracerLeaf |
createRaytracerLeaf(java.lang.Object object,
boolean asNode,
long pathId,
GraphState gs) |
void |
draw(java.lang.Object object,
boolean asNode,
RenderState rs) |
void |
generateRandomOrigins(Environment env,
RayList out,
java.util.Random rnd)
Pseudorandomly generates, for the given input, a set of origins
for this emitter.
|
void |
generateRandomRays(Environment env,
Vector3f out,
Spectrum specOut,
RayList rays,
boolean photon,
java.util.Random rnd)
Pseudorandomly generates, for the given input,
a set of scattered rays.
|
float |
getArea() |
int |
getAverageColor()
Returns an average color for the scattering entity.
|
Vector3f |
getAxis() |
int |
getFlags() |
AreaLight |
getLight() |
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. |
protected java.lang.Object |
getObject(ObjectAttribute a,
java.lang.Object placeIn,
GraphState gs) |
double |
getSurfaceArea()
Calculates the area of an object.
|
double |
getTotalPower(Environment env)
Computes the total power of this light source which is emitted to the
region defined by
env.bounds. |
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.
|
protected Node |
newInstance()
This method returns a new instance of the class of this
node.
|
static void |
pick(float height,
Vector3f axis,
Point3d origin,
Vector3d direction,
PickList list) |
void |
pick(java.lang.Object object,
boolean asNode,
Point3d origin,
Vector3d direction,
Matrix4d t,
PickList list)
Computes intersections of a given ray with this shape.
|
Light |
resolveLight() |
void |
setAxis(float x,
float y,
float z) |
void |
setAxis(Vector3f value) |
void |
setLight(AreaLight value) |
getEndPosition, getLength, getPivotShift, getStartPosition, postTransform, preTransform, setEndPoints, setEndPoints, setEndPoints, setEndPosition, setLength, setStartPositiongetInterior, getShader, getSymbolColor, getVolume, isTreatedAsInfinite, setBackShader, setColor, setColor, setFrontShader, setInterior, setMaterial, setShader, setShaders, setTreatedAsInfinitegetLocalTransformation, getTransform, getTranslation, isTransforming, setRotation, setScale, setTransform, setTransform, setTransform, setTransform, setTransform, setTransform, setTransform, setTransform, setTransforming, setTranslationaddEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, clone, cloneGraph, dump, dumpTree, dup, dupUnmanagedFields, edgeChanged, fieldModified, findAdjacent, findRefinementType, get, getAccessor, getAccessor, getAttributes, getAxisParent, getBoolean, getBranch, getBranchLength, getBranchNode, getBranchTail, getByte, getChar, getCommonAncestor, getCurrentGraphState, getDirectChildCount, getDouble, getEdgeAttributeAccessor, getEdgeAttributes, getEdgeBitsTo, getEdgeTo, getExtentIndex, getFirst, getFirstEdge, getFloat, getGraph, getId, getIndex, getInstantiator, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getShort, getSource, getStamp, getSuccessor, getSymbol, getTarget, getTransaction, getUserField, getUserFieldCount, getXClass, getXData, hasName, initProvider, initXClass, insertBranchNode, insertBranchNode, instantiateGraph, isAncestorOf, isDirection, isEncoarseOf, isManagingInstance, isMarked, isRoot, isSource, isTarget, manageableReadResolve, manageableWriteReplace, paramString, removeAll, removeEdgeBitsTo, removeFromChain, removeFromChain, removeReference, setBranch, setBranch, setExtentIndex, setGraphForDeserialization, setLayer, setMark, setName, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, toString, writeReplaceaddEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBitsequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBitMark, getObjectMark, setBitMark, setObjectMarkpublic static final Node.NType $TYPE
public static final Node.NType.Field axis$FIELD
protected AreaLight light
public static final Node.NType.Field light$FIELD
public Parallelogram()
public Parallelogram(float length,
float width)
public void accept(LightVisitor visitor)
public double completeRay(Environment env, Point3d vertex, Ray out)
completeRay in interface Emitterpublic float computeBSDF(Environment env, Vector3f in, Spectrum specIn, Vector3f out, boolean photon, Spectrum bsdf)
ScatteringThe 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 Scatteringenv - 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)photon - light ray or importance ray?bsdf - the computed spectrum of the outgoing ray will be placed in herepublic double computeExitance(Environment env, Spectrum exitance)
Emitterenv.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 Emitterenv - the environment for scatteringexitance - the exitance values will be placed in herepublic RaytracerLeaf createRaytracerLeaf(java.lang.Object object, boolean asNode, long pathId, GraphState gs)
createRaytracerLeaf in interface Raytraceablepublic void draw(java.lang.Object object,
boolean asNode,
RenderState rs)
draw in interface Renderablepublic void generateRandomOrigins(Environment env, RayList out, java.util.Random rnd)
EmitterAt 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 Emitterenv - the environmentout - the outgoing rays to be generatedrnd - pseudorandom generatorpublic void generateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean photon, java.util.Random rnd)
Scatteringadjoint 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 Scatteringenv - 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 generatedphoton - represents out a light ray or an importance ray?rnd - 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 float getArea()
public int getAverageColor()
ScatteringgetAverageColor in interface Scatteringpublic Vector3f getAxis()
public int getFlags()
getFlags in interface Scatteringpublic AreaLight getLight()
public int getLightType()
LightgetLightType in interface LightLight.NO_LIGHT, Light.POINT, Light.AREA,
Light.DIRECTIONAL, Light.SKY, Light.AMBIENT.protected Node.NType getNTypeImpl()
NodeNode.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 ShadedNullprotected java.lang.Object getObject(ObjectAttribute a, java.lang.Object placeIn, GraphState gs)
public double getSurfaceArea()
getSurfaceArea in class ShadedNullpublic double getTotalPower(Environment env)
Lightenv.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 Lightenv - environment which defines the bounds of the sceneenv.boundspublic boolean isIgnoredWhenHit()
LightisIgnoredWhenHit in interface Lighttrue iff the light source shall be ignoredpublic boolean isShadowless()
LightisShadowless in interface Lighttrue iff the light source does not cast shadowsprotected Node newInstance()
NodenewInstance in class ShadedNullpublic static void pick(float height,
Vector3f axis,
Point3d origin,
Vector3d direction,
PickList list)
public void pick(java.lang.Object object,
boolean asNode,
Point3d origin,
Vector3d direction,
Matrix4d t,
PickList list)
Pickablepick in interface Pickableobject - the object of which this shape is an attributeasNode - true iff object is a nodeorigin - the origin of the ray, in local coordinatesdirection - the direction of the ray, in local coordinatest - the transformation from local coordinates to world coordinateslist - the list to which intersections have to be addedpublic Light resolveLight()
public void setAxis(float x,
float y,
float z)
public void setAxis(Vector3f value)
public void setLight(AreaLight value)