Skip to content

PhongMaterial

Represents a material for shiny surfaces with specular highlights.

This material implements the Blinn-Phong model for calculating reflectance. It is suitable for rendering glossy or metallic surfaces that require highlights and simulate light interaction.

cpp
auto material = vglx::PhongMaterial::Create(0x049EF4);
material->specular = {0.3f, 0.3, 0.3f}
material->shininess = 32.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()

cpp
vglx::PhongMaterial::PhongMaterial(const Color &color)
ParameterDescription
colorColor of the material.

Constructs a PhongMaterial object.

Factories preferred


PhongMaterial::Create() auto

cpp
static auto vglx::PhongMaterial::Create(const Color &color=0xFFFFFF)
ParameterDescription
colorColor of the material.

Creates a shared pointer to a PhongMaterial object.

Properties

albedo_map std::shared_ptr<Texture2D>

cpp
std::shared_ptr<Texture2D> albedo_map { nullptr }

Albedo (base color) map, optionally containing an alpha channel.

alpha_map std::shared_ptr<Texture2D>

cpp
std::shared_ptr<Texture2D> alpha_map { nullptr }

Alpha map that controls the opacity across the surface.

color Color

cpp
Color color { 0xFFFFFF }

Color of the material.

normal_map std::shared_ptr<Texture2D>

cpp
std::shared_ptr<Texture2D> normal_map { nullptr }

Normal map that perturbs surface normals for detailed shading.

shininess float

cpp
float shininess { 32.0f }

How shiny the specular highlight is; a higher value gives a sharper highlight.

specular Color

cpp
Color specular { 0x111111 }

Specular color of the material.

Functions

GetType() MaterialType virtual

cpp
MaterialType vglx::PhongMaterial::GetType() const override

Returns material type.

Released under the MIT License.