- All Implemented Interfaces:
Transformation,Pickable,Raytraceable,Renderable,Light,Scattering,Manageable,PersistenceCapable,Shareable,Emitter,Light,Scattering,UserFields,XObject,Map,Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.grogra.graph.impl.Node
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Node.NTypestatic final Node.NType.Fieldprotected AreaLightstatic final Node.NType.FieldFields inherited from class de.grogra.imp3d.objects.Axis
endPosition, endPosition$FIELD, length, length$FIELD, startPosition, startPosition$FIELDFields inherited from class de.grogra.imp3d.objects.AxisBase
SCALE_V_MASK, scaleV$FIELD, USED_BITSFields inherited from class de.grogra.imp3d.objects.ShadedNull
INFINITE_MASK, interior, interior$FIELD, renderAsWireframe, renderAsWireframe$FIELD, shader, shader$FIELD, treatedAsInfinite$FIELDFields inherited from class de.grogra.imp3d.objects.Null
transform, transform$FIELD, TRANSFORMING_MASK, transforming$FIELDFields 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, MAX_RESOLUTION, MIME_TYPE, MIN_RESOLUTION, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD, RESOLUTION_BIT, RESOLUTION_MASK, resolution$FIELDFields inherited from interface de.grogra.ray.physics.Light
AMBIENT, AREA, DIRECTIONAL, NO_LIGHT, POINT, SKYFields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAPFields 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(LightVisitor visitor) doublecompleteRay(Environment env, Point3d vertex, Ray out) floatcomputeBSDF(Environment env, Vector3f in, Spectrum specIn, Vector3f out, boolean photon, Spectrum bsdf) Evaluates bidirectional scattering distribution function for given input.doublecomputeExitance(Environment env, Spectrum exitance) Evaluates the exitance function for given input.createRaytracerLeaf(Object object, boolean asNode, long pathId, GraphState gs) voiddraw(Object object, boolean asNode, RenderState rs) voidgenerateRandomOrigins(Environment env, RayList out, Random rnd) Pseudorandomly generates, for the given input, a set of origins for this emitter.voidgenerateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean photon, Random rnd) Pseudorandomly generates, for the given input, a set of scattered rays.floatgetArea()intReturns an average color for the scattering entity.getAxis()intgetFlags()getLight()intDetermines the type of light source which is represented by this light.protected Node.NTypeThis method returns theNode.NTypewhich describes the managed fields of the class of this node.protected ObjectgetObject(ObjectAttribute a, Object placeIn, GraphState gs) doubleCalculates the area of an object.doublegetTotalPower(Environment env) Computes the total power of this light source which is emitted to the region defined byenv.bounds.booleanDetermines whether the light source shall be ignored when a shot ray happens to hit the geometry of the light source.booleanDetermines whether the light source casts shadows or not.protected NodeThis method returns a new instance of the class of this node.static voidvoidComputes intersections of a given ray with this shape.voidsetAxis(float x, float y, float z) voidvoidMethods inherited from class de.grogra.imp3d.objects.Axis
getEndPosition, getLength, getPivotShift, getStartPosition, postTransform, preTransform, setEndPoints, setEndPoints, setEndPoints, setEndPosition, setLength, setStartPositionMethods inherited from class de.grogra.imp3d.objects.ShadedNull
getInterior, getShader, getSymbolColor, getVolume, isRenderAsWireframe, isTreatedAsInfinite, setBackShader, setColor, setColor, setFrontShader, setInterior, setMaterial, setRenderAsWireframe, setShader, setShaders, setTreatedAsInfiniteMethods inherited from class de.grogra.imp3d.objects.Null
getLocalTransformation, getTransform, getTranslation, isTransforming, setRotation, setScale, setTransform, setTransform, setTransform, setTransform, setTransform, setTransform, setTransform, setTransform, setTransforming, setTranslationMethods inherited from class de.grogra.graph.impl.Node
addEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, clone, cloneGraph, dump, dumpTree, dup, dupFrom, dupnew, 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, getIgnored, getIndex, getInstantiator, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getResolution, 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, setIgnored, setLayer, setMark, setName, setResolution, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, toString, writeReplaceMethods inherited from class de.grogra.graph.impl.Edge
addEdgeBits, getBitMark, getEdgeBits, getEdgeKeys, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBitsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.grogra.persistence.PersistenceCapable
getBitMark, getObjectMark, setBitMark, setObjectMark
-
Field Details
-
light
-
$TYPE
-
axis$FIELD
-
light$FIELD
-
-
Constructor Details
-
Parallelogram
public Parallelogram() -
Parallelogram
public Parallelogram(float length, float width)
-
-
Method Details
-
resolveLight
- Specified by:
resolveLightin interfaceLight
-
getNTypeImpl
Description copied from class:NodeThis method returns theNode.NTypewhich describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.- Overrides:
getNTypeImplin classShadedNull- Returns:
- type describing the managed fields of the class of this node
-
newInstance
Description copied from class:NodeThis method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.- Overrides:
newInstancein classShadedNull- Returns:
- new instance of class of this node
-
getAxis
-
setAxis
-
getLight
-
setLight
-
setAxis
public void setAxis(float x, float y, float z) -
getSurfaceArea
public double getSurfaceArea()Calculates the area of an object. (Note: both sides are counted!) Intersection with other object are not considered.The total area will be calculated. A=a*b*2- Overrides:
getSurfaceAreain classShadedNull- Returns:
- area
-
pick
-
pick
public void pick(Object object, boolean asNode, Point3d origin, Vector3d direction, Matrix4d t, PickList list) Description copied from interface:PickableComputes intersections of a given ray with this shape.- Specified by:
pickin interfacePickable- Parameters:
object- the object of which this shape is an attributeasNode-trueiff 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 added
-
draw
- Specified by:
drawin interfaceRenderable
-
getObject
-
getLightType
public int getLightType()Description copied from interface:LightDetermines the type of light source which is represented by this light.- Specified by:
getLightTypein interfaceLight- Returns:
- one of
Light.NO_LIGHT,Light.POINT,Light.AREA,Light.DIRECTIONAL,Light.SKY,Light.AMBIENT.
-
isShadowless
public boolean isShadowless()Description copied from interface:LightDetermines whether the light source casts shadows or not.- Specified by:
isShadowlessin interfaceLight- Returns:
trueiff the light source does not cast shadows
-
isIgnoredWhenHit
public boolean isIgnoredWhenHit()Description copied from interface:LightDetermines whether the light source shall be ignored when a shot ray happens to hit the geometry of the light source.- Specified by:
isIgnoredWhenHitin interfaceLight- Returns:
trueiff the light source shall be ignored
-
getAverageColor
public int getAverageColor()Description copied from interface:ScatteringReturns an average color for the scattering entity. This color is used for simplified graphical representations of the corresponding objects.- Specified by:
getAverageColorin interfaceScattering- Returns:
- an average color in Java's default sRGB color space, encoded as an int (0xAARRGGBB).
-
getFlags
public int getFlags()- Specified by:
getFlagsin interfaceScattering
-
getArea
public float getArea() -
generateRandomOrigins
Description copied from interface:EmitterPseudorandomly generates, for the given input, a set of origins for this emitter. They are generated such that they can be used for Monte Carlo-based photon tracing algorithms in the following way.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
L0(x, ν) = ∫ cos θ L(x, ω, ν) dω where θ is the angle between the surface normal and ω. Now the directional distribution of the emitted radiance at x can be described by the densityL1(x, ω, ν) = L(x, ω, ν) / L0(x, ν) so that the radiance is split intoL(x, ω, ν) = L0(x, ν) L1(x, ω, ν) Let oi and si denote the origins and spectra of the N generated rays (N =rays.size). Then for a function f(x, ν) which is to be integrated over the light surface, the sum1 / N ∑i si(ν) f(oi, ν) is an unbiased estimate for the integral∫ L0(x, ν) f(x, ν) dA The integral ranges over the whole surface A of the light source. As a consequence, the spectrum of a ray is to be considered as the ray's radiant spectral power.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:
W0(x, ν) = ∫ cos θ W(x, ω, ν) dω The formulas for light sources are valid for sensors if the L-quantites are replaced by the corresponding W-quantities.
W(x, ω, ν) = W0(x) W1(x, ω, ν)Let px be the probability density used for the ray origin, then the field
originDensityis 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 valueoriginDensitywill be set to a multiple ofScattering.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.
- Specified by:
generateRandomOriginsin interfaceEmitter- Parameters:
env- the environmentout- the outgoing rays to be generatedrnd- pseudorandom generator
-
computeExitance
Description copied from interface:EmitterEvaluates the exitance function for given input. The computed value is the spectrum of the radiant exitance (emitted power per area) L0j(x, ν) at the pointenv.pointin 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)ifenv.pointhappened to be one of the randomly generated origins.- Specified by:
computeExitancein interfaceEmitter- Parameters:
env- the environment for scatteringexitance- the exitance values will be placed in here- Returns:
- the value of the probability density for the ray origin
-
generateRandomRays
public void generateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean photon, Random rnd) Description copied from interface:ScatteringPseudorandomly generates, for the given input, a set of scattered rays. The scattered rays are generated such that they can be used for a Monte Carlo integration of a function f(ω;ν) over cos θ BSDF(ωi, νi; ωo, νo) in the following way:-
If
adjointisfalse,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, μ) -
Otherwise,
adjointistrue. 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 sum1 / N ∑i si(ν) f(di; ν) is an unbiased estimate for the integral∫ cos θ f(ω; ν) g(ω, ν; θ is the angle between the surface normal and ω. The domain of integration is the whole sphere, since the bidirectional scattering distribution includes both reflection and transmission (BSDF = BRDF + BTDF).out, μ)specOut(μ) dμ dωIf this
Scatteringinstance is in fact aLightsource,adjointistrue, and the BSDF is defined as BSDF(out, μ; ω, ν) = L1(ω, ν) δ(μ - ν), i.e., the directional distribution of the emitted radiance atenv.point, seeEmitter. In this case,outis not used.If this
Scatteringinstance is in fact aSensor,adjointisfalse, and the BSDF is defined as BSDF(ω, ν;out, μ) = W1(ω, ν) δ(μ - ν), i.e., the directional distribution of the emitted importance atenv.point, seeEmitter. In this case,outis not used.Let pω be the probability density used for the ray direction (measured with respect to solid angle ω), then the field
directionDensityof 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 valuedirectionDensitywill be set to a multiple ofScattering.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.
- Specified by:
generateRandomRaysin interfaceScattering- Parameters:
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 generatedphoton- representsouta light ray or an importance ray?rnd- pseudorandom generator- See Also:
-
If
-
computeBSDF
public float computeBSDF(Environment env, Vector3f in, Spectrum specIn, Vector3f out, boolean photon, Spectrum bsdf) Description copied from interface:ScatteringEvaluates bidirectional scattering distribution function for given input.The computed spectrum is an integral over the spectrum of the following product:
|cos θ| BSDF(ωi, νi; ωo, νo) where BSDF is the bidirectional scattering distribution function (= BRDF + BTDF) at the pointenv.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 andout.If
adjointisfalse,inandoutdescribe true light rays from light sources to sensors. In this case, ωi =in, ωo =out, and the integral is Otherwise,bsdf(ν) = |cos θ| ∫ BSDF(in, νi;out, ν)specIn(νi) dνiadjointistrue.inandoutthen describe importance rays (inverse light rays from sensors to light sources). In this case, ωi =out, ωo =in, and the integral isbsdf(ν) = |cos θ| ∫ BSDF(out, ν;in, νo)specIn(νo) dνoIf this
Scatteringinstance is in fact aLightsource,adjointisfalse, and the BSDF is defined as BSDF(in, μ; ω, ν) = L1(ω, ν) δ(μ - ν), i.e., the directional distribution of the emitted radiance atenv.point, seeEmitter. In this case,inis not used.If this
Scatteringinstance is in fact aSensor,adjointistrue, and the BSDF is defined as BSDF(ω, ν;in, μ) = W1(ω, ν) δ(μ - ν), i.e., the directional distribution of the emitted importance atenv.point, seeEmitter. In this case,inis 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.- Specified by:
computeBSDFin interfaceScattering- Parameters:
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)photon- light ray or importance ray?bsdf- the computed spectrum of the outgoing ray will be placed in here- Returns:
- the value of the probability density for the ray direction
-
getTotalPower
Description copied from interface:LightComputes the total power of this light source which is emitted to the region defined byenv.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.- Specified by:
getTotalPowerin interfaceLight- Parameters:
env- environment which defines the bounds of the scene- Returns:
- total power emitted to the region
env.bounds
-
completeRay
- Specified by:
completeRayin interfaceEmitter
-
createRaytracerLeaf
- Specified by:
createRaytracerLeafin interfaceRaytraceable
-
accept
-