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.
auto material = vglx::PhongMaterial::Create({
.color = 0x049EF4,
.specular_color = 0x333333,
.shininess = 64.0f,
.albedo_map = texture
});
my_scene->Add(vglx::Mesh::Create(geometry, material));INFO
Derives from Material and inherits all public properties and methods.
Construction
Constructors
PhongMaterial()
Constructs a Phong material with default parameters.
PhongMaterial::PhongMaterial();PhongMaterial()
Constructs a Phong material from the given parameters.
PhongMaterial::PhongMaterial(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters. |
Factories preferred
PhongMaterial::Create() std::shared_ptr<PhongMaterial>
Creates a shared instance of PhongMaterial with default parameters.
static std::shared_ptr<PhongMaterial> PhongMaterial::Create();PhongMaterial::Create() std::shared_ptr<PhongMaterial>
Creates a shared instance of PhongMaterial.
static std::shared_ptr<PhongMaterial> PhongMaterial::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters. |
Types
PhongMaterial::Parameters struct
Parameters for constructing a PhongMaterial object.
| Parameter | Description |
|---|---|
| color Color | Diffuse base color. |
| specular_color Color | Specular highlight tint. |
| emissive_color Color | Emissive color independent of lighting. |
| ao_intensity float | AO contribution strength. |
| shininess float | Specular highlight glossiness. |
| emissive_intensity float | Emissive multiplier. |
| normal_intensity float | Normal map strength. |
| reflectivity float | Environment reflection strength. |
| albedo_map std::shared_ptr<Texture> | Diffuse color map. |
| alpha_map std::shared_ptr<Texture> | Per-pixel opacity map. |
| ao_map std::shared_ptr<Texture> | Ambient occlusion map (R channel). |
| emissive_map std::shared_ptr<Texture> | Emissive color map. |
| environment_map std::shared_ptr<CubeTexture> | Environment reflection cube map. |
| normal_map std::shared_ptr<Texture> | Surface normal map. |
| specular_map std::shared_ptr<Texture> | Specular intensity map. |
Properties
Albedo (diffuse) map defining base color and optional alpha channel.
std::shared_ptr<Texture> albedo_map {};Alpha map defining per-pixel opacity.
std::shared_ptr<Texture> alpha_map {};ao_intensity float
Strength of the ambient occlusion contribution.
float ao_intensity {};Ambient occlusion map sampled from the R channel; modulates the ambient term.
std::shared_ptr<Texture> ao_map {};Emissive color added to the final shaded result, independent of lighting.
Color emissive_color {};emissive_intensity float
Scalar multiplier for emissive contribution.
float emissive_intensity {};Emissive map modulating the emissive color per texel.
std::shared_ptr<Texture> emissive_map {};environment_map std::shared_ptr<CubeTexture>
Environment cube map sampled for reflection contribution.
std::shared_ptr<CubeTexture> environment_map {};normal_intensity float
Scalar multiplier for normal map perturbation.
float normal_intensity {};Normal map for per-pixel surface detail and lighting variation.
std::shared_ptr<Texture> normal_map {};reflectivity float
Strength of the environment map reflection contribution.
float reflectivity {};shininess float
Controls the glossiness of highlights; higher values yield sharper specular peaks.
float shininess {};Specular color controlling the tint of specular highlights.
Color specular_color {};Specular map scaling the intensity of specular highlights.
std::shared_ptr<Texture> specular_map {};Functions
Identifies this material as Material::Type::PhongMaterial.
Type PhongMaterial::GetType() const override;