Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.grogra.ray.physics
Interface Scattering

All Known Subinterfaces:
  Emitter, Light, Light, Scattering, Sensor, Shader, Shader

All Known Implementing Classes:
  AlgorithmSwitchShader, AmbientLight, Camera, DirectionalLight, IORShader, LightBase, Material, MaterialRef, Parallelogram, Phong, PhysicalLight, PointLight, RGBAShader, SensorNode, ShaderRef, SideSwitchShader, Sky, SpectralLight, SpotLight, SunSkyLight, SunSkyToDirectionalLightWrapper, SwitchShader

    public interface Scattering

A `Scattering` instance represents a scattering entity: Either a surface `Shader`, a `Light` source, or a `Sensor`. Methods are provided that a Monte Carlo-based raytracer needs for lighting calculations. This allows for any desired bidirectional scattering distribution functions (BSDF) in implementations of `Scattering`.

Author:
  Ole Kniemeyer

Field Summary
`static float` | `DELTA_FACTOR` A large `float` value (1010) used as a common factor for representing non-zero values of δ-distributions.
`static int` | `IS_NON_OPAQUE`
`static int` | `MIN_UNUSED_FLAG`
`static int` | `NEEDS_NORMAL`
`static int` | `NEEDS_POINT`
`static int` | `NEEDS_TANGENTS`
`static int` | `NEEDS_TRANSFORMATION`
`static int` | `NEEDS_UV`
`static int` | `RANDOM_RAYS_GENERATE_ORIGINS`

Method Summary
`float` | `computeBSDF(Environment env, Vector3f in, Spectrum specIn, Vector3f out, boolean adjoint, Spectrum bsdf)` Evaluates bidirectional scattering distribution function for given input.
`void` | `generateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean adjoint, java.util.Random random)` Pseudorandomly generates, for the given input, a set of scattered rays.
`int` | `getAverageColor()` Returns an average color for the scattering entity.
`int` | `getFlags()`

Field Detail

### DELTA_FACTOR

    static final float DELTA_FACTOR

  A large `float` value (1010) used as a common factor for representing non-zero values of δ-distributions.

  See Also:
    Constant Field Values

### IS_NON_OPAQUE

    static final int IS_NON_OPAQUE

See Also:
  Constant Field Values

### MIN_UNUSED_FLAG

    static final int MIN_UNUSED_FLAG

See Also:
  Constant Field Values

### NEEDS_NORMAL

    static final int NEEDS_NORMAL

See Also:
  Constant Field Values

### NEEDS_POINT

    static final int NEEDS_POINT

See Also:
  Constant Field Values

### NEEDS_TANGENTS

    static final int NEEDS_TANGENTS

See Also:
  Constant Field Values

### NEEDS_TRANSFORMATION

    static final int NEEDS_TRANSFORMATION

See Also:
  Constant Field Values

### NEEDS_UV

    static final int NEEDS_UV

See Also:
  Constant Field Values

### RANDOM_RAYS_GENERATE_ORIGINS

    static final int RANDOM_RAYS_GENERATE_ORIGINS

See Also:
  Constant Field Values

Method Detail

### computeBSDF

    float computeBSDF(Environment env,
                      Vector3f in,
                      Spectrum specIn,
                      Vector3f out,
                      boolean adjoint,
                      Spectrum bsdf)

  Evaluates 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 point `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
  Otherwise, `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 `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.

  Parameters:
    `env` - the environment for scattering
    `in` - the (negated) direction unit vector of the incoming ray (i.e., pointing away from the surface)
    `specIn` - the spectrum of the incoming ray
    `out` - 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
  Returns:
    the value of the probability density for the ray direction

### generateRandomRays

    void generateRandomRays(Environment env,
                            Vector3f out,
                            Spectrum specOut,
                            RayList rays,
                            boolean adjoint,
                            java.util.Random random)

  Pseudorandomly 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 `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`, μ)
  - Otherwise, `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`, μ; ω, ν)
  Let di and si denote the directions and spectra of the N generated rays (N = `rays.size`). Then, for every frequency ν the sum
  1 / N ∑i si(ν) f(di; ν)
  is an unbiased estimate for the integral
  ∫ cos θ f(ω; ν) g(ω, ν; `out`, μ) `specOut`(μ) dμ dω
  θ 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).

  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 `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.

  Parameters:
    `env` - the environment for scattering
    `out` - the direction unit vector of the outgoing ray (i.e., pointing away from the surface)
    `specOut` - the spectrum of the outgoing ray
    `rays` - the rays to be generated
    `adjoint` - represents `out` a light ray or an importance ray?
    `random` - pseudorandom generator
  See Also:
    `computeBSDF(de.grogra.ray.physics.Environment, javax.vecmath.Vector3f, de.grogra.ray.physics.Spectrum, javax.vecmath.Vector3f, boolean, de.grogra.ray.physics.Spectrum)`

### getAverageColor

    int getAverageColor()

  Returns an average color for the scattering entity. This color is used for simplified graphical representations of the corresponding objects.

  Returns:
    an average color in Java's default sRGB color space, encoded as an int (0xAARRGGBB).

### getFlags

    int getFlags()

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD