3.4. Optical Material Base Classes

The Bidirectional Scattering Distribution Function (BSDF) function describes how incoming light is split into the reflected (bidirectional reflectance distribution function BRDF) and transmitted (bidirectional transmittance distribution function BTDF) components. See wikipedia.

class raysect.optical.material.material.Material

Bases: raysect.core.material.Material

Base class for optical material classes.

Derived classes must implement the evaluate_surface() and evaluate_volume() methods.

evaluate_surface()

Virtual method for evaluating the spectrum at a material surface.

Parameters
  • world (World) – The world scenegraph belonging to this material.

  • ray (Ray) – The ray incident at the material surface.

  • primitive (Primitive) – The geometric shape the holds this material (i.e. mesh, cylinder, etc.).

  • hit_point (Point3D) – The point where the ray is incident on the primitive surface.

  • exiting (bool) – Boolean toggle indicating if this ray is exiting or entering the material surface (True means ray is exiting).

  • inside_point (Point3D) –

  • outside_point (Point3D) –

  • normal (Normal3D) – The surface normal vector at location of hit_point.

  • world_to_primitive (AffineMatrix3D) – Affine matrix defining transformation from world space to local primitive space.

  • primitive_to_world (AffineMatrix3D) – Affine matrix defining transformation from local primitive space to world space.

  • intersection (Intersection) – The full ray-primitive intersection object.

evaluate_volume()

Virtual method for evaluating the spectrum emitted/absorbed along the rays trajectory through a material surface.

Parameters
  • spectrum (Spectrum) – The spectrum already accumulated along the ray path. Don’t overwrite this array, add the materials emission/absorption to the existing spectrum.

  • world (World) – The world scenegraph belonging to this material.

  • ray (Ray) – The ray incident at the material surface.

  • primitive (Primitive) – The geometric shape the holds this material (i.e. mesh, cylinder, etc.).

  • start_point (Point3D) – The starting point of the ray’s trajectory through the material.

  • end_point (Point3D) – The end point of the ray’s trajectory through the material.

  • world_to_primitive (AffineMatrix3D) – Affine matrix defining transformation from world space to local primitive space.

  • primitive_to_world (AffineMatrix3D) – Affine matrix defining transformation from local primitive space to world space.

importance

Importance sampling weight for this material.

Only effective if importance sampling is turned on.

Return type

float

class raysect.optical.material.material.NullSurface

Bases: raysect.optical.material.material.Material

A base class for materials that have volume properties such as emission/absorption but no surface properties (e.g. a plasma). This material will launch a new ray after the initial ray has transited the material primitive’s volume. evaluate_volume() must be implemented by the deriving class.

evaluate_surface()

Virtual method for evaluating the spectrum at a material surface.

Parameters
  • world (World) – The world scenegraph belonging to this material.

  • ray (Ray) – The ray incident at the material surface.

  • primitive (Primitive) – The geometric shape the holds this material (i.e. mesh, cylinder, etc.).

  • hit_point (Point3D) – The point where the ray is incident on the primitive surface.

  • exiting (bool) – Boolean toggle indicating if this ray is exiting or entering the material surface (True means ray is exiting).

  • inside_point (Point3D) –

  • outside_point (Point3D) –

  • normal (Normal3D) – The surface normal vector at location of hit_point.

  • world_to_primitive (AffineMatrix3D) – Affine matrix defining transformation from world space to local primitive space.

  • primitive_to_world (AffineMatrix3D) – Affine matrix defining transformation from local primitive space to world space.

  • intersection (Intersection) – The full ray-primitive intersection object.

class raysect.optical.material.material.NullVolume

Bases: raysect.optical.material.material.Material

A base class for materials that have surface properties such as reflection but no volume properties (e.g. a metallic mirror). evaluate_surface() must be implemented by the deriving class.

evaluate_volume()

Virtual method for evaluating the spectrum emitted/absorbed along the rays trajectory through a material surface.

Parameters
  • spectrum (Spectrum) – The spectrum already accumulated along the ray path. Don’t overwrite this array, add the materials emission/absorption to the existing spectrum.

  • world (World) – The world scenegraph belonging to this material.

  • ray (Ray) – The ray incident at the material surface.

  • primitive (Primitive) – The geometric shape the holds this material (i.e. mesh, cylinder, etc.).

  • start_point (Point3D) – The starting point of the ray’s trajectory through the material.

  • end_point (Point3D) – The end point of the ray’s trajectory through the material.

  • world_to_primitive (AffineMatrix3D) – Affine matrix defining transformation from world space to local primitive space.

  • primitive_to_world (AffineMatrix3D) – Affine matrix defining transformation from local primitive space to world space.

class raysect.optical.material.material.DiscreteBSDF

Bases: raysect.optical.material.material.Material

A base class for materials implementing a discrete BSDF.

evaluate_surface()

Virtual method for evaluating the spectrum at a material surface.

Parameters
  • world (World) – The world scenegraph belonging to this material.

  • ray (Ray) – The ray incident at the material surface.

  • primitive (Primitive) – The geometric shape the holds this material (i.e. mesh, cylinder, etc.).

  • hit_point (Point3D) – The point where the ray is incident on the primitive surface.

  • exiting (bool) – Boolean toggle indicating if this ray is exiting or entering the material surface (True means ray is exiting).

  • inside_point (Point3D) –

  • outside_point (Point3D) –

  • normal (Normal3D) – The surface normal vector at location of hit_point.

  • world_to_primitive (AffineMatrix3D) – Affine matrix defining transformation from world space to local primitive space.

  • primitive_to_world (AffineMatrix3D) – Affine matrix defining transformation from local primitive space to world space.

  • intersection (Intersection) – The full ray-primitive intersection object.

class raysect.optical.material.material.ContinuousBSDF

Bases: raysect.optical.material.material.Material

A base class for materials implementing a continuous BSDF.

bsdf()

Returns the surface bi-directional scattering distribution function (BSDF).

The BSDF is calculated for the given wavelength, incoming and outgoing surface space directions.

Parameters
  • s_incident (Vector3D) – The surface space incident vector, \(\omega_i\).

  • s_reflected (Vector3D) – The surface space reflected vector, \(\omega_o\).

  • wavelength (float) – The wavelength \(\lambda\) at which to perform the BSDF evaluation.

Returns

The BSDF value, \(BSDF(\omega_i, \omega_o, \lambda)\)

evaluate_surface()

Virtual method for evaluating the spectrum at a material surface.

Parameters
  • world (World) – The world scenegraph belonging to this material.

  • ray (Ray) – The ray incident at the material surface.

  • primitive (Primitive) – The geometric shape the holds this material (i.e. mesh, cylinder, etc.).

  • hit_point (Point3D) – The point where the ray is incident on the primitive surface.

  • exiting (bool) – Boolean toggle indicating if this ray is exiting or entering the material surface (True means ray is exiting).

  • inside_point (Point3D) –

  • outside_point (Point3D) –

  • normal (Normal3D) – The surface normal vector at location of hit_point.

  • world_to_primitive (AffineMatrix3D) – Affine matrix defining transformation from world space to local primitive space.

  • primitive_to_world (AffineMatrix3D) – Affine matrix defining transformation from local primitive space to world space.

  • intersection (Intersection) – The full ray-primitive intersection object.