|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.vecmath.Tuple4f javax.vecmath.Color4f de.grogra.imp3d.shading.RGBAShader
public final class RGBAShader
A RGBAShader
implements a simple lambertian
material with a single color and an alpha-value for the
transparency. Some methods which are related to the color
palette of the EGA graphics card are declared, they are used
in the context of the emulation of the GROGRA software.
Field Summary | |
---|---|
static ManageableType |
$TYPE
|
static RGBAShader |
BLACK
RGBAShader whose color is Color.BLACK . |
static RGBAShader |
BLUE
RGBAShader whose color is Color.BLUE . |
static RGBAShader |
CYAN
RGBAShader whose color is Color.CYAN . |
static RGBAShader |
DARK_GRAY
RGBAShader whose color is Color.DARK_GRAY . |
static RGBAShader |
EGA_0
RGBAShader whose color is EGA color number 0. |
static RGBAShader |
EGA_1
RGBAShader whose color is EGA color number 1. |
static RGBAShader |
EGA_10
RGBAShader whose color is EGA color number 10. |
static RGBAShader |
EGA_11
RGBAShader whose color is EGA color number 11. |
static RGBAShader |
EGA_12
RGBAShader whose color is EGA color number 12. |
static RGBAShader |
EGA_13
RGBAShader whose color is EGA color number 13. |
static RGBAShader |
EGA_14
RGBAShader whose color is EGA color number 14. |
static RGBAShader |
EGA_15
RGBAShader whose color is EGA color number 15. |
static RGBAShader |
EGA_2
RGBAShader whose color is EGA color number 2. |
static RGBAShader |
EGA_3
RGBAShader whose color is EGA color number 3. |
static RGBAShader |
EGA_4
RGBAShader whose color is EGA color number 4. |
static RGBAShader |
EGA_5
RGBAShader whose color is EGA color number 5. |
static RGBAShader |
EGA_6
RGBAShader whose color is EGA color number 6. |
static RGBAShader |
EGA_7
RGBAShader whose color is EGA color number 7. |
static RGBAShader |
EGA_8
RGBAShader whose color is EGA color number 8. |
static RGBAShader |
EGA_9
RGBAShader whose color is EGA color number 9. |
static RGBAShader |
GRAY
RGBAShader whose color is Color.GRAY . |
static RGBAShader |
GREEN
RGBAShader whose color is Color.GREEN . |
static RGBAShader |
LIGHT_GRAY
RGBAShader whose color is Color.LIGHT_GRAY . |
static RGBAShader |
MAGENTA
RGBAShader whose color is Color.MAGENTA . |
static RGBAShader |
ORANGE
RGBAShader whose color is Color.ORANGE . |
static RGBAShader |
PINK
RGBAShader whose color is Color.PINK . |
static RGBAShader |
RED
RGBAShader whose color is Color.RED . |
static RGBAShader |
WHITE
RGBAShader whose color is Color.WHITE . |
static RGBAShader |
YELLOW
RGBAShader whose color is Color.YELLOW . |
Fields inherited from class javax.vecmath.Tuple4f |
---|
w, x, y, z |
Fields inherited from interface de.grogra.ray.physics.Shader |
---|
LAMBERTIAN_VARIANCE |
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.icon.Icon |
---|
DEFAULT, DISABLED |
Constructor Summary | |
---|---|
RGBAShader()
|
|
RGBAShader(Color4f color)
|
|
RGBAShader(float red,
float green,
float blue)
|
|
RGBAShader(float red,
float green,
float blue,
float alpha)
|
|
RGBAShader(int rgba)
Specify colors as ARGB integer. |
|
RGBAShader(Shader a)
|
Method Summary | |
---|---|
void |
accept(ShaderVisitor visitor)
|
void |
addReference(SharedObjectReference ref)
|
void |
appendReferencesTo(java.util.List out)
|
java.lang.Object |
clone()
|
float |
computeBSDF(Environment env,
Vector3f in,
Spectrum specIn,
Vector3f out,
boolean adjoint,
Spectrum bsdf)
Evaluates bidirectional scattering distribution 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 |
fieldModified(PersistenceField field,
int[] indices,
Transaction t)
|
static RGBAShader |
forEGAColor(int index)
Returns the RGBAShader whose color has the
specified index in the palette of the EGA graphics card. |
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. |
static int |
getEGAColorIndex(Color3f c)
Returns the index of the color in the palette of the EGA graphics card which is closest to the specified color. |
static int |
getEGAColorIndex(Color4f c)
Returns the index of the color in the palette of the EGA graphics card which is closest to the specified color. |
static int |
getEGAColorIndex(float r,
float g,
float b)
Returns the index of the color in the palette of the EGA graphics card which is closest to the specified color. |
int |
getFlags()
|
Icon |
getIcon(java.awt.Dimension size,
int state)
|
java.awt.Rectangle |
getIconBounds()
|
IconSource |
getIconSource()
|
java.awt.Image |
getImage()
|
java.awt.Image |
getImage(int w,
int h)
|
java.net.URL |
getImageSource()
|
ManageableType |
getManageableType()
|
java.awt.Dimension |
getPreferredIconSize(boolean small)
|
SharedObjectProvider |
getProvider()
|
int |
getStamp()
Returns a stamp for this object. |
void |
initProvider(SharedObjectProvider provider)
|
boolean |
isMutable()
|
boolean |
isPredefined()
|
boolean |
isTransparent()
|
Manageable |
manageableReadResolve()
|
java.lang.Object |
manageableWriteReplace()
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics2D g,
int x,
int y,
int w,
int h,
int state)
|
void |
prepareIcon()
|
void |
removeReference(SharedObjectReference ref)
|
void |
scale(double r,
Tuple3d color)
|
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 javax.vecmath.Color4f |
---|
get, set |
Methods inherited from class javax.vecmath.Tuple4f |
---|
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, epsilonEquals, equals, equals, get, get, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, sub, sub, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ManageableType $TYPE
public static final RGBAShader BLACK
RGBAShader
whose color is Color.BLACK
.
public static final RGBAShader BLUE
RGBAShader
whose color is Color.BLUE
.
public static final RGBAShader CYAN
RGBAShader
whose color is Color.CYAN
.
public static final RGBAShader DARK_GRAY
RGBAShader
whose color is Color.DARK_GRAY
.
public static final RGBAShader EGA_0
RGBAShader
whose color is EGA color number 0.
public static final RGBAShader EGA_1
RGBAShader
whose color is EGA color number 1.
public static final RGBAShader EGA_10
RGBAShader
whose color is EGA color number 10.
public static final RGBAShader EGA_11
RGBAShader
whose color is EGA color number 11.
public static final RGBAShader EGA_12
RGBAShader
whose color is EGA color number 12.
public static final RGBAShader EGA_13
RGBAShader
whose color is EGA color number 13.
public static final RGBAShader EGA_14
RGBAShader
whose color is EGA color number 14.
public static final RGBAShader EGA_15
RGBAShader
whose color is EGA color number 15.
public static final RGBAShader EGA_2
RGBAShader
whose color is EGA color number 2.
public static final RGBAShader EGA_3
RGBAShader
whose color is EGA color number 3.
public static final RGBAShader EGA_4
RGBAShader
whose color is EGA color number 4.
public static final RGBAShader EGA_5
RGBAShader
whose color is EGA color number 5.
public static final RGBAShader EGA_6
RGBAShader
whose color is EGA color number 6.
public static final RGBAShader EGA_7
RGBAShader
whose color is EGA color number 7.
public static final RGBAShader EGA_8
RGBAShader
whose color is EGA color number 8.
public static final RGBAShader EGA_9
RGBAShader
whose color is EGA color number 9.
public static final RGBAShader GRAY
RGBAShader
whose color is Color.GRAY
.
public static final RGBAShader GREEN
RGBAShader
whose color is Color.GREEN
.
public static final RGBAShader LIGHT_GRAY
RGBAShader
whose color is Color.LIGHT_GRAY
.
public static final RGBAShader MAGENTA
RGBAShader
whose color is Color.MAGENTA
.
public static final RGBAShader ORANGE
RGBAShader
whose color is Color.ORANGE
.
public static final RGBAShader PINK
RGBAShader
whose color is Color.PINK
.
public static final RGBAShader RED
RGBAShader
whose color is Color.RED
.
public static final RGBAShader WHITE
RGBAShader
whose color is Color.WHITE
.
public static final RGBAShader YELLOW
RGBAShader
whose color is Color.YELLOW
.
Constructor Detail |
---|
public RGBAShader()
public RGBAShader(Color4f color)
public RGBAShader(float red, float green, float blue)
public RGBAShader(float red, float green, float blue, float alpha)
public RGBAShader(int rgba)
rgba
- color as 0xAARRGGBBpublic RGBAShader(Shader a)
Method Detail |
---|
public void accept(ShaderVisitor visitor)
public void addReference(SharedObjectReference ref)
addReference
in interface Shareable
public void appendReferencesTo(java.util.List out)
appendReferencesTo
in interface Shareable
public java.lang.Object clone()
clone
in class Color4f
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 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 fieldModified(PersistenceField field, int[] indices, Transaction t)
fieldModified
in interface Manageable
public static final RGBAShader forEGAColor(int index)
RGBAShader
whose color has the
specified index in the palette of the EGA graphics card.
index
- palette index (only the lowest 4 bits are used)
public 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 static final int getEGAColorIndex(Color3f c)
c
- a color
public static final int getEGAColorIndex(Color4f c)
c
- a color
public static final int getEGAColorIndex(float r, float g, float b)
r
- red value of color (between 0 and 1)g
- green value of color (between 0 and 1)b
- blue value of color (between 0 and 1)
public int getFlags()
getFlags
in interface Scattering
public Icon getIcon(java.awt.Dimension size, int state)
getIcon
in interface IconSource
public java.awt.Rectangle getIconBounds()
getIconBounds
in interface Icon
public IconSource getIconSource()
getIconSource
in interface Icon
public java.awt.Image getImage()
getImage
in interface Icon
public java.awt.Image getImage(int w, int h)
getImage
in interface Icon
public java.net.URL getImageSource()
getImageSource
in interface Icon
public ManageableType getManageableType()
getManageableType
in interface Manageable
public java.awt.Dimension getPreferredIconSize(boolean small)
getPreferredIconSize
in interface IconSource
public SharedObjectProvider getProvider()
getProvider
in interface Shareable
public int getStamp()
Manageable
getStamp
in interface Manageable
public void initProvider(SharedObjectProvider provider)
initProvider
in interface Shareable
public boolean isMutable()
isMutable
in interface Icon
public boolean isPredefined()
public boolean isTransparent()
isTransparent
in interface Shader
public Manageable manageableReadResolve()
manageableReadResolve
in interface Manageable
public java.lang.Object manageableWriteReplace()
manageableWriteReplace
in interface Manageable
public void paintIcon(java.awt.Component c, java.awt.Graphics2D g, int x, int y, int w, int h, int state)
paintIcon
in interface Icon
public void prepareIcon()
prepareIcon
in interface Icon
public void removeReference(SharedObjectReference ref)
removeReference
in interface Shareable
public void scale(double r, Tuple3d color)
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 |