Metal class

A metallic material that reflects light into the (potentially rough) mirror reflection direction.

Base classes

class Material
A base class used to represent surface material properties.

Public functions

auto scatter(const Ray3f& ray, const HitInfo& hit, Color3f& attenuation, Ray3f& scattered) const -> bool override
Compute the scattered direction scattered at a surface hitpoint.

Public variables

Color3f albedo
The reflective color (fraction of light that is reflected per color channel).
float roughness
A value between 0 and 1 indicating how smooth vs. rough the reflection should be.

Function documentation

bool Metal::scatter(const Ray3f& ray, const HitInfo& hit, Color3f& attenuation, Ray3f& scattered) const override

Compute the scattered direction scattered at a surface hitpoint.

Parameters
ray in incoming ray
hit in the ray's intersection with the surface
attenuation in how much the light should be attenuated
scattered in the direction light should be scattered
Returns bool True if the surface scatters light

The base Material does not scatter any light, so it simply returns false.