PTMaterial

PTMaterial

Abstract class for materials for path tracer

Constructor

(abstract) new PTMaterial()

Source:

Constructor.

Classes

PTMaterial

Members

isPTMaterial :boolean

Source:

Says that the object inherits from PTMaterial

Type:
  • boolean

usesNormal

Source:

Says whether the material requires the normal to the shape for its computation. Default is true.

usesUVMap

Source:

Says whether the material requires a UV map on the shape for its computation. Default is false.

Methods

glslInstance() → {string}

Source:

Compile all the function directly related to the object (e.g. render).

Returns:
Type
string

(abstract) glslRender() → {string}

Source:

Return the chunk of GLSL code used to compute the color of the material at the given point The render function on the GLSL side should have one of the signatures

  • vec3 {{name}}_render(RelVector v)
  • vec3 {{name}}_render(RelVector v, RelVector normal)
  • vec3 {{name}}_render(RelVector v, vec2 uv)
  • vec3 {{name}}_render(RelVector v, RelVector normal, vec2 uv) The exact signature depends whether the material requires a normal or UV coordinates. Here v is the vector obtained when we hit the shape. It should return the color as a vec3 of the material at the given point, without taking into account reflections.
Returns:
Type
string