PhongMaterial
This material implements a classic Blinn–Phong lighting model with diffuse and specular reflection. It is intended for standard lit geometry that requires view-dependent highlights, such as polished surfaces or simple metals.
It supports a base color, specular color, shininess exponent, and optional texture maps for albedo, alpha, normals, and specular intensity.
auto material = vglx::PhongMaterial::Create(0x049EF4);
material->specular = 0x333333;
material->shininess = 64.0f;
material->albedo_map = texture;
auto mesh = vglx::Mesh::Create(geometry, material);
scene->Add(mesh);INFO
Derives from Material and inherits all public properties and methods.
Construction
Constructors
PhongMaterial()
Constructs a Phong material with a given base color.
PhongMaterial::PhongMaterial(const Color& color);| Parameter | Description |
|---|---|
| color | Base diffuse color of the material. |
Factories preferred
PhongMaterial::Create() auto
Creates a shared instance of PhongMaterial.
static auto PhongMaterial::Create(const Color& color=0xFFFFFF);| Parameter | Description |
|---|---|
| color | Base diffuse color of the material. |
Properties
Albedo (diffuse) map defining base color and optional alpha channel.
std::shared_ptr<Texture2D> albedo_map {nullptr};Alpha map defining per-pixel opacity.
std::shared_ptr<Texture2D> alpha_map {nullptr};Normal map for per-pixel surface detail and lighting variation.
std::shared_ptr<Texture2D> normal_map {nullptr};shininess float
Controls the glossiness of highlights; higher values yield sharper specular peaks.
float shininess {32.0f};Specular color controlling the tint of specular highlights.
Color specular {0x111111};Specular map scaling the intensity of specular highlights.
std::shared_ptr<Texture2D> specular_map {nullptr};Functions
Identifies this material as Material::Type::PhongMaterial.
Type PhongMaterial::GetType() const override;