- All Superinterfaces:
Scattering
- All Known Subinterfaces:
Shader
- All Known Implementing Classes:
AlgorithmSwitchShader
,IORShader
,Material
,MaterialRef
,Phong
,RGBAShader
,ShaderRef
,SideSwitchShader
,SunSkyLight
,SwitchShader
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.- Author:
- Ole Kniemeyer
-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
The angular variance of a lambertian reflector, (π2 - 4) / 8.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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
void
Computes color of outgoing light ray for given input.Methods inherited from interface de.grogra.ray.physics.Scattering
computeBSDF, generateRandomRays, getAverageColor, getFlags
-
Field Details
-
LAMBERTIAN_VARIANCE
static final float LAMBERTIAN_VARIANCEThe angular variance of a lambertian reflector, (π2 - 4) / 8.
-
-
Method Details
-
shade
Computes color of outgoing light ray for given input. The computed value is, for each color component j = R, G, B, the following sum over all incident rays k:∑k |cos θk| BSDFj(ωk, where BSDFj is the bidirectional scattering distribution function (= BRDF + BTDF) at the pointout
) ck,jenv.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.
- Parameters:
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
-
computeMaxRays
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. The reflection probability density (measured with respect to solid angle) for the outgoing importance direction (i.e., incoming light direction) ω, given a fixed incident directionin
, ispr(ω) = cos θ BRDF(ω, where BRDF is the bidirectional reflectivity distribution function, θ the angle between the surface normal and ω, and R the total reflectivity for the incident direction, i.e., the integral over cos θ BRDF(ω,in
) / Rin
). 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 ofreflected.color
andtransmitted.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.
- Parameters:
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 fromreflected
transmitted
- the transmitted ray with maximal probabilitytransVariance
- the angular mean quadratic deviation fromtransmitted
-
isTransparent
boolean isTransparent()
-