QcMaterialMips Namespace
The next mip level of the material atlases (decision E-908): every 2 x 2 block of texels into one. More...
| Header: | #include <clientcore/materials/QcMaterialMips.h> |
Functions
| QcMaterialSynthesizer::Maps | halve(const QImage &normal, const QImage &specular) |
| QImage | normalAt(const QImage &normal, int size) |
| QImage | specularAt(const QImage &specular, int size) |
Detailed Description
Function Documentation
QcMaterialSynthesizer::Maps QcMaterialMips::halve(const QImage &normal, const QImage &specular)
Returns the next level of normal and specular. Normals are decoded, averaged and normalised again (occlusion and height averaged); where the four normals spread, the averaged vector is shorter, and the smoothness of the specular texel is lowered by Toksvig's rule (roughness^2 + (1 - length) / length), so bumpy surfaces do not turn glossy in the distance. Reflectance and porosity are averaged; a metal code wins over a dielectric value when two or more of the four texels are metal (codes are not averaged). Emission is averaged as light (0 is none in the atlas).
QImage QcMaterialMips::normalAt(const QImage &normal, int size)
Returns the single normal map normal (a pack's _n) at size x size: halved with halve() (channels apart, normals normalised again; never QImage's smooth scaling, which mixes premultiplied channels and loses them where alpha is low) while larger than size, repeated texel by texel when smaller.
QImage QcMaterialMips::specularAt(const QImage &specular, int size)
Returns the single specular map specular (a pack's _s) at size x size, scaled like normalAt().