|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.grogra.imp3d.CameraBase
de.grogra.imp3d.Camera
public class Camera
Nested Class Summary | |
---|---|
static class |
Camera.Type
|
Field Summary | |
---|---|
static Camera.Type |
$TYPE
|
protected float |
maxZ
|
static SCOType.Field |
maxZ$FIELD
|
protected float |
minZ
|
static SCOType.Field |
minZ$FIELD
|
protected Projection |
projection
|
static SCOType.Field |
projection$FIELD
|
protected SharedObjectProvider |
sop
|
protected Matrix4d |
transformation
|
static SCOType.Field |
transformation$FIELD
|
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 |
Constructor Summary | |
---|---|
Camera()
|
|
Camera(Projection p)
|
Method Summary | |
---|---|
void |
addReference(SharedObjectReference ref)
|
void |
appendReferencesTo(java.util.List out)
|
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. |
static Camera |
createBackView()
|
static Camera |
createBottomView()
|
static Camera |
createFrontView()
|
static Camera |
createLeftView()
|
static Camera |
createParallel()
|
static Camera |
createPerspective()
|
static Camera |
createRightView()
|
static Camera |
createTopView()
|
void |
fieldModified(PersistenceField field,
int[] indices,
Transaction t)
|
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 adjoint,
java.util.Random rnd)
Pseudorandomly generates, for the given input, a set of scattered rays. |
int |
getAverageColor()
Returns an average color for the scattering entity. |
int |
getFlags()
|
ManageableType |
getManageableType()
|
Projection |
getProjection()
|
SharedObjectProvider |
getProvider()
|
void |
getRay(float x,
float y,
Point3d origin,
Vector3d direction)
Determines the ray which starts at the camera and goes through the specified point on the image plane of the camera. |
float |
getScaleAt(double x,
double y,
double z)
Computes an estimate for the scaling factor from 3D world coordinates at (x, y, z) to 2D coordinates
on the camera plane. |
float |
getScaleAt(float z)
Computes an estimate for the scaling factor from view coordinates around a depth of z to 2D coordinates
on the camera plane. |
int |
getStamp()
Returns a stamp for this object. |
Matrix4d |
getTransformation()
|
float[] |
getUVForVertex(Environment env,
Point3d vertex)
|
void |
getViewToClipTransformation(Matrix4d m)
Computes the transformation from view coordinates (= camera coordinates, not world coordinates!) |
Matrix4d |
getWorldToViewTransformation()
Returns the world-to-view transformation of this camera. |
float |
getZFar()
|
float |
getZNear()
|
void |
initProvider(SharedObjectProvider provider)
|
Manageable |
manageableReadResolve()
|
java.lang.Object |
manageableWriteReplace()
|
boolean |
projectView(float px,
float py,
float pz,
Tuple2f point2D,
boolean checkClip)
|
boolean |
projectWorld(double px,
double py,
double pz,
Tuple2f point2D)
|
void |
removeReference(SharedObjectReference ref)
|
void |
setProjection(Projection value)
|
void |
setTransformation(Matrix4d value)
|
void |
setZFar(float maxZ)
|
void |
setZNear(float minZ)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Camera.Type $TYPE
protected float maxZ
public static final SCOType.Field maxZ$FIELD
protected float minZ
public static final SCOType.Field minZ$FIELD
protected Projection projection
public static final SCOType.Field projection$FIELD
protected transient SharedObjectProvider sop
protected final Matrix4d transformation
public static final SCOType.Field transformation$FIELD
Constructor Detail |
---|
public Camera()
public Camera(Projection p)
Method Detail |
---|
public void addReference(SharedObjectReference ref)
addReference
in interface Shareable
public void appendReferencesTo(java.util.List out)
appendReferencesTo
in interface Shareable
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 static Camera createBackView()
public static Camera createBottomView()
public static Camera createFrontView()
public static Camera createLeftView()
public static Camera createParallel()
public static Camera createPerspective()
public static Camera createRightView()
public static Camera createTopView()
public void fieldModified(PersistenceField field, int[] indices, Transaction t)
fieldModified
in interface Manageable
public void generateRandomOrigins(Environment env, RayList out, java.util.Random rnd)
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 generatedrnd
- pseudorandom generatorpublic void generateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean adjoint, java.util.Random rnd)
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?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 int getAverageColor()
Scattering
getAverageColor
in interface Scattering
public int getFlags()
getFlags
in interface Scattering
public ManageableType getManageableType()
getManageableType
in interface Manageable
public Projection getProjection()
public SharedObjectProvider getProvider()
getProvider
in interface Shareable
public void getRay(float x, float y, Point3d origin, Vector3d direction)
CameraBase
getRay
in class CameraBase
x
- the x-coordinate on the image planey
- the y-coordinate on the image planeorigin
- the origin of the ray, in world coordinatesdirection
- the direction of the ray, in world coordinatespublic float getScaleAt(double x, double y, double z)
CameraBase
(x, y, z)
to 2D coordinates
on the camera plane.
getScaleAt
in class CameraBase
x
- x world coordinatey
- y world coordinatez
- z world coordinate
public float getScaleAt(float z)
CameraBase
z
to 2D coordinates
on the camera plane.
getScaleAt
in class CameraBase
z
- z view coordinate
public int getStamp()
Manageable
getStamp
in interface Manageable
public Matrix4d getTransformation()
public float[] getUVForVertex(Environment env, Point3d vertex)
getUVForVertex
in interface Sensor
public void getViewToClipTransformation(Matrix4d m)
m
- the transformation is placed in herepublic Matrix4d getWorldToViewTransformation()
CameraBase
getWorldToViewTransformation
in class CameraBase
public float getZFar()
getZFar
in class CameraBase
public float getZNear()
getZNear
in class CameraBase
public void initProvider(SharedObjectProvider provider)
initProvider
in interface Shareable
public Manageable manageableReadResolve()
manageableReadResolve
in interface Manageable
public java.lang.Object manageableWriteReplace()
manageableWriteReplace
in interface Manageable
public boolean projectView(float px, float py, float pz, Tuple2f point2D, boolean checkClip)
public boolean projectWorld(double px, double py, double pz, Tuple2f point2D)
public void removeReference(SharedObjectReference ref)
removeReference
in interface Shareable
public void setProjection(Projection value)
public void setTransformation(Matrix4d value)
public void setZFar(float maxZ)
public void setZNear(float minZ)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |