miniRT
By Marcelo Magalhães and Ygor G. Sena, 2023.
s_material Struct Reference

A material has a surface color and four attributes from the Phong Reflection Model: ambient, diffuse, specular and shininess. Each one of these attributes accept a non negative floating point number. For ambient, diffuse and specular, the typical values are between 0 and 1. For shininess, values between 10 (very large highlight) and 200 (very small) highlight seem to work best, though there is no actual upper bound. More...

#include <materials.h>

Collaboration diagram for s_material:

Data Fields

t_color color
 
t_color ambient
 
float diffuse
 
float specular
 
float shininess
 
t_pattern pattern
 

Detailed Description

A material has a surface color and four attributes from the Phong Reflection Model: ambient, diffuse, specular and shininess. Each one of these attributes accept a non negative floating point number. For ambient, diffuse and specular, the typical values are between 0 and 1. For shininess, values between 10 (very large highlight) and 200 (very small) highlight seem to work best, though there is no actual upper bound.

Parameters
colorStores the material's color in RGB values.
ambientRepresents the background lighting or the light reflected from other objects in the enviroment.
diffuseRepresents the light reflected from a matted surface. It depends only on the angle between the light source and surface normal.
specularRepresents the reflection of the light source itself and results in the bright sport on a curved surface. It depends on the angle between the reflection vector and the eye vector. Thus, it's also controlled by the parameter shininess.
shininessRepresents the shininess. The higher the shininess, the smaller and tigher the specular highlight.
patternRepresents the pattern texture of a given material. It can be a striped or a checkered pattern.