Public Member Functions |
| | Specification () |
| | Specification (const Any &any) |
| | Construct a Material::Specification from an Any, typically loaded by parsing a file.
|
| | Specification (const Color3 &lambertian) |
| size_t | hashCode () const |
| void | load (const std::string &filename) |
| | Load from a file created by save().
|
| bool | operator!= (const Specification &s) const |
| bool | operator== (const Specification &s) const |
| void | removeBump () |
| void | removeEmissive () |
| void | removeLambertian () |
| | Makes the surface opaque black.
|
| void | removeSpecular () |
| void | removeTransmissive () |
| void | setBump (const std::string &filename, const BumpMap::Settings &settings=BumpMap::Settings(), float normalMapWhiteHeightInPixels=-0.02f) |
| | The image is assumed to be in linear (R) space.
|
| void | setBump (const BumpMap::Specification &bump) |
| void | setCustomShaderPrefix (const std::string &s) |
| void | setDepthWriteHintDistance (float hint) |
| | Distance below which Surface::depthWriteHint returns true.
|
| void | setEmissive (const std::string &filename, const Color3 &constant=Color3::one()) |
| | The image file is assumed to be in the sRGB color space.
|
| void | setEmissive (const Color3 &constant) |
| void | setEmissive (const Texture::Specification &spec, const Color3 &constant=Color3::one()) |
| void | setEta (float etaTransmit, float etaReflect) |
| | Set the index of refraction.
|
| void | setGlossyExponentShininess (int e) |
| | Same as setShininess(SuperBSDF::packSpecularExponent(e))
|
| void | setLambertian (const std::string &filename, const Color4 &constant=Color4::one()) |
| | Filename of Lambertian (diffuse) term, empty if none.
|
| void | setLambertian (const Texture::Specification &spec, const Color4 &constant=Color4::one()) |
| void | setLambertian (const std::string &filename, float c) |
| void | setLambertian (const Color4 &constant) |
| void | setLambertian (float c) |
| void | setMirrorHint (MirrorQuality q) |
| | Defaults to G3D::MirrorQuality::STATIC_ENV.
|
| void | setMirrorShininess () |
| | Same as setShininess(SuperBSDF::packedSpecularMirror())
|
| void | setRefractionHint (RefractionQuality q) |
| | Defaults to G3D::RefractionQuality::DYNAMIC_FLAT.
|
| void | setShininess (const std::string &filename, float constant=1.0f) |
| | The constant multiplies packed values stored in the file.
|
| void | setShininess (const Texture::Specification &spec) |
| | If a specular filename is set as well, the specular specification overrides all of the settings except for the filename itself.
|
| void | setShininess (float constant) |
| | Packed sharpness of the specular highlight.
|
| void | setSpecular (const std::string &filename, const Color3 &constant=Color3::one()) |
| | Mirror reflection or glossy reflection.
|
| void | setSpecular (const Color3 &constant) |
| void | setSpecular (const Texture::Specification &spec, const Color3 &constant=Color3::one()) |
| void | setTransmissive (const std::string &filename, const Color3 &constant=Color3::one()) |
| | This is an approximation of attenuation due to extinction while traveling through a translucent material.
|
| void | setTransmissive (const Color3 &constant) |
| void | setTransmissive (const Texture::Specification &spec, const Color3 &constant=Color3::one()) |
| Any | toAny () const |
Specification of a material; used for loading.
Can be written to a file or constructed from a series of calls.
The following terminology for photon scattering is used in the G3D::Material::Specification and G3D::BSDF classes and their documentation:
| G3D::Material::Specification::Specification |
( |
const Any & |
any | ) |
|
Construct a Material::Specification from an Any, typically loaded by parsing a file.
Some simple examples follow.
All fields as texture maps:
Material::Specification {
lambertian = "diffusemap.png";
specular = "specmap.png";
shininess = "shinemap.png";
transmissive = "transmap.png";
etatransmit = 1.0;
extinctionTransmit = Color3(1,1,1);
etaReflect = 1.0;
extinctionReflect = Color3(1,1,1);
}
Diffuse yellow (any Color3 automatically coerces to a pure Lambertian surface):
Simple diffuse texture (any string coerces to a filename for the Lambertian texture):
Mirror:
Material::Specification {
lambertian = Color3(0.01),
specular = Color3(0.9),
shininess = mirror()
}
Red plastic:
Material::Specification {
lambertian = Color3(0.95, 0.2, 0.05);
specular = Color3(0.3);
shininess = glossyExponent(200);
}
Green glass:
Material::Specification {
lambertian = Color3(0.01, 0.1, 0.05);
transmissive = Color3(0.01, 0.9, 0.01);
specular = Color3(0.4);
shininess = mirror();
}
- See Also
- G3D::RefractionQuality,
-
G3D::MirrorQuality,
-
G3D::BumpMapSpecification
- BETA API Likely to receive incompatible changes in future releases.
Filename of Lambertian (diffuse) term, empty if none.
The alpha channel is a mask that will be applied to all maps for coverage. That is, alpha = 0 indicates holes in the surface. Alpha is for partial coverage. Do not use alpha for transparency; set transmissiveFilename instead.
The image file is assumed to be in the sRGB color space. The constant is multiplied in "linear" space, after sRGB->RGB conversion.
Referenced by setLambertian().