MaterialX 1.39.1
|
Spherical harmonics functionality. More...
#include <MaterialXRender/Export.h>
#include <MaterialXRender/Image.h>
#include <MaterialXRender/Types.h>
Go to the source code of this file.
Classes | |
class | ShCoeffs< C, B > |
Class template for a vector of spherical harmonic coefficients. More... | |
Typedefs | |
using | Sh3ScalarCoeffs = ShCoeffs< double, 3 > |
Double-precision scalar coefficients for third-order spherical harmonics. | |
using | Sh3ColorCoeffs = ShCoeffs< Color3d, 3 > |
Double-precision color coefficients for third-order spherical harmonics. | |
Functions | |
MX_RENDER_API Sh3ColorCoeffs | projectEnvironment (ConstImagePtr env, bool irradiance=false) |
Project an environment map to third-order SH, with an optional convolution to convert radiance to irradiance. More... | |
MX_RENDER_API ImagePtr | normalizeEnvironment (ConstImagePtr env, float envRadiance, float maxTexelRadiance) |
Normalize an environment to the given radiance. More... | |
MX_RENDER_API void | computeDominantLight (ConstImagePtr env, Vector3 &lightDir, Color3 &lightColor) |
Compute the dominant light direction and color of an environment map. More... | |
MX_RENDER_API ImagePtr | renderEnvironment (const Sh3ColorCoeffs &shEnv, unsigned int width, unsigned int height) |
Render the given spherical harmonic signal to an environment map. More... | |
MX_RENDER_API ImagePtr | renderReferenceIrradiance (ConstImagePtr env, unsigned int width, unsigned int height) |
Render a reference irradiance map from the given environment map, using brute-force computations for a slow but accurate result. More... | |
Spherical harmonics functionality.
MX_RENDER_API void computeDominantLight | ( | ConstImagePtr | env, |
Vector3 & | lightDir, | ||
Color3 & | lightColor | ||
) |
Compute the dominant light direction and color of an environment map.
env | An environment map in lat-long format. |
lightDir | Returns the dominant light direction of the environment. |
lightColor | Returns the color of the light from the dominant direction. |
MX_RENDER_API ImagePtr normalizeEnvironment | ( | ConstImagePtr | env, |
float | envRadiance, | ||
float | maxTexelRadiance | ||
) |
Normalize an environment to the given radiance.
env | An environment map in lat-long format. |
envRadiance | The radiance to which the environment map should be normalized. |
maxTexelRadiance | The maximum radiance allowed for any individual texel of the map. |
MX_RENDER_API Sh3ColorCoeffs projectEnvironment | ( | ConstImagePtr | env, |
bool | irradiance = false |
||
) |
Project an environment map to third-order SH, with an optional convolution to convert radiance to irradiance.
env | An environment map in lat-long format. |
irradiance | If true, then the returned signal will be convolved by a clamped cosine kernel to generate irradiance. |
MX_RENDER_API ImagePtr renderEnvironment | ( | const Sh3ColorCoeffs & | shEnv, |
unsigned int | width, | ||
unsigned int | height | ||
) |
Render the given spherical harmonic signal to an environment map.
shEnv | The color signal of the environment encoded as third-order SH. |
width | The width of the output environment map. |
height | The height of the output environment map. |
MX_RENDER_API ImagePtr renderReferenceIrradiance | ( | ConstImagePtr | env, |
unsigned int | width, | ||
unsigned int | height | ||
) |
Render a reference irradiance map from the given environment map, using brute-force computations for a slow but accurate result.
env | An environment map in lat-long format. |
width | The width of the output irradiance map. |
height | The height of the output irradiance map. |