3.5. Optical Surface Materials

3.5.1. Absorber

class raysect.optical.material.absorber.AbsorbingSurface

Bases: raysect.optical.material.material.NullVolume

A perfectly absorbing surface material.

>>> from raysect.primitive import Sphere
>>> from raysect.optical import World
>>> from raysect.optical.material import AbsorbingSurface
>>>
>>> # set-up scenegraph
>>> world = World()
>>> absorber = Sphere(radius=0.01, parent=world, material=AbsorbingSurface())

3.5.2. Emitters

class raysect.optical.material.emitter.UnitySurfaceEmitter

Bases: raysect.optical.material.material.NullVolume

Uniform and isotropic surface emitter with emission 1W/str/m^2/ x nm, where x is the spectrum’s wavelength interval.

This material is useful for general purpose debugging and testing energy conservation.

>>> from raysect.primitive import Sphere
>>> from raysect.optical import World
>>> from raysect.optical.material import UnitySurfaceEmitter
>>>
>>> # set-up scenegraph
>>> world = World()
>>> emitter = Sphere(radius=0.01, parent=world, material=UnitySurfaceEmitter())
class raysect.optical.material.emitter.UniformSurfaceEmitter

Bases: raysect.optical.material.material.NullVolume

Uniform and isotropic surface emitter.

Uniform emission will be given by the emission_spectrum multiplied by the emission scale.

Parameters
  • emission_spectrum (SpectralFunction) – The surface’s emission function.

  • scale (float) – Scale of the emission function (default = 1 W/m^2/str/nm).

>>> from raysect.primitive import Sphere
>>> from raysect.optical import World, ConstantSF
>>> from raysect.optical.material import UniformSurfaceEmitter
>>>
>>> # set-up scenegraph
>>> world = World()
>>> emitter = Sphere(radius=0.01, parent=world)
>>> emitter.material=UniformSurfaceEmitter(ConstantSF(1.0))
class raysect.optical.material.AnisotropicSurfaceEmitter

Bases: raysect.optical.material.material.NullVolume

Base class for anisotropic surface emitters.

Simplifies the development of anisotropic light sources. The emitter spectrum can be varied based on the angle between the normal and incident observation direction, and the side of the surface.

class raysect.optical.material.Checkerboard

Bases: raysect.optical.material.material.NullVolume

Isotropic checkerboard surface emitter

Defines a plane of alternating squares of emission forming a checkerboard pattern. Useful in debugging and as a light source in test scenes.

Parameters
  • width (float) – The width of the squares in metres.

  • emission_spectrum1 (SpectralFunction) – Emission spectrum for square one.

  • emission_spectrum2 (SpectralFunction) – Emission spectrum for square two.

  • scale1 (float) – Intensity of square one emission.

  • scale2 (float) – Intensity of square two emission.

>>> from raysect.primitive import Box
>>> from raysect.optical import World, rotate, Point3D, d65_white
>>> from raysect.optical.material import Checkerboard
>>>
>>> world = World()
>>>
>>> # checker board wall that acts as emitter
>>> emitter = Box(lower=Point3D(-10, -10, 10), upper=Point3D(10, 10, 10.1), parent=world,
                  transform=rotate(45, 0, 0))
>>> emitter.material=Checkerboard(4, d65_white, d65_white, 0.1, 2.0)

3.5.3. Lambertian

class raysect.optical.material.lambert.Lambert

Bases: raysect.optical.material.material.ContinuousBSDF

An ideal Lambertian surface material.

A Lambertian is a perfectly diffuse surface that scatters light equally in all directions. It is a good approximation to many real world surfaces.

Parameters

reflectivity (SpectralFunction) – Reflectance function which defines the fraction of light scattered at each wavelength.

>>> from raysect.primitive import Sphere
>>> from raysect.optical import World, ConstantSF
>>> from raysect.optical.material import Lambert
>>>
>>> # set-up scenegraph
>>> world = World()
>>> sphere = Sphere(radius=0.01, parent=world)
>>> sphere.material=Lambert(0.25)  # 25% diffuse reflectivity

3.5.4. Conductors

class raysect.optical.material.conductor.Conductor

Bases: raysect.optical.material.material.Material

Conductor material.

The conductor material simulates the interaction of light with a homogeneous conducting material, such as, gold, silver or aluminium.

This material implements the Fresnel equations for a conducting surface. To use the material, the complex refractive index of the conductor must be supplied.

Parameters
  • index (SpectralFunction) – Real component of the refractive index - \(n(\lambda)\).

  • extinction (SpectralFunction) – Imaginary component of the refractive index (extinction) - \(k(\lambda)\).

>>> import numpy as np
>>> from raysect.optical import InterpolatedSF
>>> from raysect.optical.material import Conductor
>>>
>>> wavelength = np.array(...)
>>> index = InterpolatedSF(wavelength, np.array(...))
>>> extinction = InterpolatedSF(wavelength, np.array(...))
>>>
>>> metal = Conductor(index, extinction)
class raysect.optical.material.conductor.RoughConductor

Bases: raysect.optical.material.material.ContinuousBSDF

This is implementing Cook-Torrence with conducting fresnel microfacets.

Smith shadowing and GGX facet distribution used to model roughness.

Parameters
  • index (SpectralFunction) – Real component of the refractive index - \(n(\lambda)\).

  • extinction (SpectralFunction) – Imaginary component of the refractive index (extinction) - \(k(\lambda)\).

  • roughness (float) – The roughness parameter in range (0, 1]. 0 is perfectly specular, 1 is perfectly rough.

>>> import numpy as np
>>> from raysect.optical import InterpolatedSF
>>> from raysect.optical.material import RoughConductor
>>>
>>> wavelength = np.array(...)
>>> index = InterpolatedSF(wavelength, np.array(...))
>>> extinction = InterpolatedSF(wavelength, np.array(...))
>>>
>>> rough_metal = RoughConductor(index, extinction, 0.25)

3.5.5. Dielectrics

class raysect.optical.material.dielectric.Dielectric

Bases: raysect.optical.material.material.Material

An ideal dielectric material.

Parameters
  • index (SpectralFunction) – Refractive index as a function of wavelength.

  • transmission (SpectralFunction) – Transmission per metre as a function of wavelength.

  • external_index (SpectralFunction) – Refractive index of the external material at the interface, defaults to a vacuum (n=1).

  • transmission_only (bool) – toggles transmission only, no reflection (default=False).

>>> from raysect.optical import ConstantSF
>>> from raysect.optical.material import Dielectric, Sellmeier
>>>
>>> diamond_material = Dielectric(Sellmeier(0.3306, 4.3356, 0.0, 0.1750**2, 0.1060**2, 0.0),
                                  ConstantSF(1))
class raysect.optical.material.dielectric.Sellmeier

Bases: raysect.optical.spectralfunction.NumericallyIntegratedSF

Material with refractive index defined by Sellmeier equation

Parameters
  • b1 (float) – Sellmeier \(B_1\) coefficient.

  • b2 (float) – Sellmeier \(B_2\) coefficient.

  • b3 (float) – Sellmeier \(B_3\) coefficient.

  • c1 (float) – Sellmeier \(C_1\) coefficient.

  • c2 (float) – Sellmeier \(C_2\) coefficient.

  • c3 (float) – Sellmeier \(B_1\) coefficient.

  • sample_resolution (float) – The numerical sampling resolution in nanometers.

>>> from raysect.optical import ConstantSF
>>> from raysect.optical.material import Dielectric, Sellmeier
>>>
>>> diamond_material = Dielectric(Sellmeier(0.3306, 4.3356, 0.0, 0.1750**2, 0.1060**2, 0.0),
                                  ConstantSF(1))

3.5.6. Modifiers

class raysect.optical.material.modifiers.Blend

Bases: raysect.optical.material.material.Material

Blend combines the behaviours of two materials.

This modifier is used to blend together the behaviours of two different materials. Which material handles the interaction for an incoming ray is determined by a random choice, weighted by the ratio argument. Low values of ratio bias the selection towards material 1, high values to material 2.

It is the responsibility of the user to ensure the material combination is physically valid.

By default both the volume and surface responses are blended. This may be configured with the surface_only and volume_only parameters. If blending is disabled the response from material 1 is returned.

Blend can be used to approximate finely sputtered surfaces consisting of a mix of materials. For example it can be used to crudely approximate a gold coated glass surface:

material = Blend(schott(‘N-BK7’), Gold(), 0.1, surface_only=True)

Parameters
  • m1 – The first material.

  • m2 – The second material.

  • ratio – A double value in the range (0, 1).

  • surface_only – Only blend the surface response (default=False).

  • volume_only – Only blend the volume response (default=False).

class raysect.optical.material.modifiers.Add

Bases: raysect.optical.material.material.Material

Adds the response of two materials.

This modifier is used to sum together the behaviours of two different materials. The surface response is the simple sum of the two surface material responses. The volume response is more nuanced. The volume method of material 1 is applied first, followed by the volume method of material 2. Depending on the choice of volume material, this may result in a simple summation or a more complex interaction.

The Add modifier should be used with caution, it is possible to produce unphysical material combinations that violate energy conservation. It is the responsibility of the user to ensure the material combination is physically valid.

By default both the volume and surface responses are combined. This may be configured with the surface_only and volume_only parameters. If summation is disabled the response from material 1 is returned.

Add can be used to introduce a surface emission component to a non-emitting surface. For example, A hot metal surface can be approximated by adding a black body emitter to a metal material:

material = Add(

Iron(), UniformSurfaceEmitter(BlackBody(800)), surface_only=True

)

Combining volumes is more complex and must only be used with materials that are mathematically commutative, for example two volume emitters or two absorbing volumes.

Parameters
  • m1 – The first material.

  • m2 – The second material.

  • surface_only – Only blend the surface response (default=False).

  • volume_only – Only blend the volume response (default=False).

class raysect.optical.material.modifiers.VolumeTransform

Bases: raysect.optical.material.material.Material

Translate/rotate the volume material relative to the primitive.

Applies an affine transform to the start and end points of the volume response calculation. This modifier is intended for use with volume texture materials, allowing them to be translated/rotated.

As a modifier material, it takes another material (the base material) as an argument. Using a supplied an affine transform, this material will modify the start and end coordinate of the volume integration.

Parameters
  • material – The base material.

  • transform – An affine transform.

class raysect.optical.material.modifiers.Roughen

Bases: raysect.optical.material.material.Material

Modifies the surface normal to approximate a rough surface.

This is a modifier material, it takes another material (the base material) as an argument.

The roughen modifier works by randomly deflecting the surface normal about its true position before passing the intersection parameters on to the base material.

The deflection is calculated by interpolating between the existing normal and a vector sampled from a cosine weighted hemisphere. The strength of the interpolation, and hence the roughness of the surface, is controlled by the roughness argument. The roughness argument takes a value in the range [0, 1] where 1 is a fully rough, lambert-like surface and 0 is a smooth, untainted surface.

Parameters
  • material – The base material.

  • roughness – A double value in the range [0, 1].

3.5.7. Debugging

This module contains materials to aid with debugging and creating test scenes.

class raysect.optical.material.emitter.Checkerboard

Bases: raysect.optical.material.material.NullVolume

Isotropic checkerboard surface emitter

Defines a plane of alternating squares of emission forming a checkerboard pattern. Useful in debugging and as a light source in test scenes.

Parameters
  • width (float) – The width of the squares in metres.

  • emission_spectrum1 (SpectralFunction) – Emission spectrum for square one.

  • emission_spectrum2 (SpectralFunction) – Emission spectrum for square two.

  • scale1 (float) – Intensity of square one emission.

  • scale2 (float) – Intensity of square two emission.

>>> from raysect.primitive import Box
>>> from raysect.optical import World, rotate, Point3D, d65_white
>>> from raysect.optical.material import Checkerboard
>>>
>>> world = World()
>>>
>>> # checker board wall that acts as emitter
>>> emitter = Box(lower=Point3D(-10, -10, 10), upper=Point3D(10, 10, 10.1), parent=world,
                  transform=rotate(45, 0, 0))
>>> emitter.material=Checkerboard(4, d65_white, d65_white, 0.1, 2.0)
class raysect.optical.material.debug.Light

Bases: raysect.optical.material.material.NullVolume

A Lambertian surface material illuminated by a distant light source.

This debug material lights the primitive from the world direction specified by a vector passed to the light_direction parameter. An optional intensity and emission spectrum may be supplied. By default the light spectrum is the D65 white point spectrum.

Parameters
  • light_direction (Vector3D) – A world space Vector3D defining the light direction.

  • intensity (float) – The light intensity in units of radiance (default is 1.0).

  • spectrum (SpectralFunction) – A SpectralFunction defining the light’s emission spectrum (default is D65 white).

class raysect.optical.material.debug.PerfectReflectingSurface

Bases: raysect.optical.material.material.Material

A material that is perfectly reflecting.