Skip to content
Chuck Walbourn edited this page Apr 27, 2022 · 6 revisions

This is an implementation of the original D3DXMath library spherical harmonics math functions using DirectXMath.

See this blog post for more information and details.

API

All functions are in the C++ namespace DirectX

XMSHEvalDirection

Evaluates the Spherical Harmonic basis functions. Equivalent to D3DXSHEvalDirection function.

XMSHRotate

Rotates SH vector by a rotation matrix. Equivalent to the D3DXSHRotate function.

XMSHRotateZ

Rotates the SH vector in the Z axis by an angle. Equivalent to the D3DXSHRotateZ function.

XMSHAdd

Adds two SH vectors. Equivalent to the D3DXSHAdd function.

XMSHScale

Scales a SH vector. Equivalent to the D3DXSHScale function.

XMSHDot

Computes the dot product of two SH vectors. Equivalent to the D3DXSHDot function.

XMSHMultiply, XMSHMultiply2/3/4/5/6

Computes the product of two functions represented using SH. Equivalent to D3DXSHMultiply2, D3DXSHMultiply3, D3DXSHMultiply4, D3DXSHMultiply5, and D3DXSHMultiply6.

XMSHEvalDirectionalLight

Evaluates a directional light and returns spectral SH data. Equivalent to the D3DXSHEvalDirectionalLight function.

XMSHEvalSphericalLight

Evaluates a spherical light and returns spectral SH data. Equivalent to the D3DXEvalSphericalLight function.

XMSHEvalConeLight

Evaluates a light that is a cone of constant intensity and returns spectral SH data. Equivalent to the D3DXSHEvalConeLight function.

XMSHEvalHemisphereLight

Evaluates a light that is a linear interpolant between two colors over the sphere. Equivalent to the D3DXSHEvalHemisphereLight function.

SHProjectCubeMap

Projects a function represented in a cube map into spherical harmonics. Equivalent to the D3DX11SHProjectCubeMap function.

For DirectX 11, you must do #include <d3d11.h> before #include <DirectXSH.h>.

For DirectX 12, you must do #include <d3d12.h> before #include <DirectXSH.h>.

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Xbox One
  • Xbox Series X|S
  • Windows Subsystem for Linux

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v18
  • GCC 10.5, 11.4, 12.3
  • MinGW 12.2, 13.2
  • Intel Classic Compiler
  • Intel oneAPI Compiler

Related Projects

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXMesh

DirectXTex

Tools

Test Suite

See also

DirectX Landing Page

Clone this wiki locally