Skip to content

Material

Defined in: radiance/src/materials/Material.ts:19

How a surface scatters and gives off light. Each material is one 128-byte record of the path tracer’s material table (design record 0004, “The record”), and the kernel’s shading functions (kernels/materials.shade.ts) read it. A subclass says which scattering it asks for by its type. What the kernel does for each type lives in TypeShade, as three.js keeps its shading in TSL nodes.

The setter of every parameter adds 1 to version. The renderer also compares each material’s record with the last frame’s, so an edit in place, such as material.color.setHex(0xff0000), reaches the next frame too.

new Material(color, emissive): Material

Defined in: radiance/src/materials/Material.ts:39

Color

Color

Material

readonly id: number

Defined in: radiance/src/materials/Material.ts:20


name: string = ''

Defined in: radiance/src/materials/Material.ts:22

A name for the author. The renderer does not read it.


abstract readonly type: number

Defined in: radiance/src/materials/Material.ts:26

The scattering the kernel applies: 0 diffuse, 1 mirror, 2 physical.


version: number = 0

Defined in: radiance/src/materials/Material.ts:24

Incremented by the setter of every parameter.

get color(): Color

Defined in: radiance/src/materials/Material.ts:45

The fraction of light reflected, per channel.

Color

set color(value): void

Defined in: radiance/src/materials/Material.ts:48

Color

void


get doubleSided(): boolean

Defined in: radiance/src/materials/Material.ts:63

Whether the surface gives off light from its back face too. Default false.

boolean

set doubleSided(value): void

Defined in: radiance/src/materials/Material.ts:66

boolean

void


get emissive(): Color

Defined in: radiance/src/materials/Material.ts:54

The light the surface gives off from its front face, as radiance.

Color

set emissive(value): void

Defined in: radiance/src/materials/Material.ts:57

Color

void


get flatShading(): boolean

Defined in: radiance/src/materials/Material.ts:76

Whether the kernel shades with the geometric normal in place of the interpolated vertex normals, as three.js’s material.flatShading does. Default false. The geometry and the hits do not change (design record 0004, “Flat shading”).

boolean

set flatShading(value): void

Defined in: radiance/src/materials/Material.ts:79

boolean

void