de.grogra.ray.physics
public interface Shader extends Scattering
Shader instance represents a surface shader which
calculates the color of an outgoing light ray at a given point
as a function of geometrical and optical properties,
namely local and global point coordinates, canonical uv-coordinates, surface
tangent vectors, outgoing ray direction, index of refraction,
and a list of incident light rays, consisting of color and direction.| Modifier and Type | Field and Description |
|---|---|
static float |
LAMBERTIAN_VARIANCE
The angular variance of a lambertian reflector,
(π2 - 4) / 8.
|
DELTA_FACTOR, IS_NON_OPAQUE, MIN_UNUSED_FLAG, NEEDS_NORMAL, NEEDS_POINT, NEEDS_TANGENTS, NEEDS_TRANSFORMATION, NEEDS_UV, RANDOM_RAYS_GENERATE_ORIGINS| Modifier and Type | Method and Description |
|---|---|
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.
|
boolean |
isTransparent() |
void |
shade(Environment env,
RayList in,
Vector3f out,
Spectrum specOut,
Tuple3d color)
Computes color of outgoing light ray for given input.
|
computeBSDF, generateRandomRays, getAverageColor, getFlagsstatic final float LAMBERTIAN_VARIANCE
void computeMaxRays(Environment env, Vector3f in, Spectrum specIn, Ray reflected, Tuple3f refVariance, Ray transmitted, Tuple3f transVariance)
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 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.
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 reflectedtransmitted - the transmitted ray with maximal probabilitytransVariance - the angular mean quadratic deviation from transmittedboolean isTransparent()
void shade(Environment env, RayList in, Vector3f out, Spectrum specOut, Tuple3d color)
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.
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