Julius Ikkala

Jacobian Determinant Zoo

Introduction

This article is intended to be a compendium of Jacobian determinants of various mappings commonly used in computer graphics. I intend to keep updating this article with new mappings in the future.

This is also a follow-up to the Jacobian matrix post, so if you need a primer on what these are and why you should care, read that first (or Wikipedia, or PBRT).

Notation

Useful properties of Jacobian determinants

Jacobian determinants can be used to compute the probability density function (PDF) of a mapping T(ξ)T(\xi), where ξ\xi is a uniform random sample in [0,1]N[0, 1]^N:

p(ξ)=1∣JT(ξ)∣ p(\xi) = \frac{1}{|\mathbf{J_T(\xi)}|}

For multiple importance sampling (MIS), you need to evaluate the probability of a given direction ω\omega as if it was sampled using a given mapping. Therefore, you need a function like:

p(ω)=1∣JT(T−1(ω))∣ p(\omega) = \frac{1}{|\mathbf{J_T}(T^{-1}(\omega))|}

Jacobian determinants have a useful property for this:

∣JT(ξ)∣=∣JT−1(T(ξ))∣−1 |\mathbf{J_T}(\xi)| = |\mathbf{J_{T^{-1}}}(T(\xi))|^{-1}

Because ∣JT−1(ω)∣|\mathbf{J_{T^{-1}}}(\omega)| is often simpler than ∣JT(ξ)∣|\mathbf{J_T}(\xi)|, it is often convenient to express the PDF in terms of ∣JT−1∣|\mathbf{J_{T^{-1}}}|:

p(ω)=1∣JT(T−1(ω))∣=∣JT−1(ω)∣ p(\omega) = \frac{1}{|\mathbf{J_T}(T^{-1}(\omega))|} = |\mathbf{J_{T^{-1}}}(\omega)|

As such, I've also listed the Jacobian determinants of the inverse mappings in this article as well.

Jacobian determinants can also be chained. If you have two mappings, TT and UU, then the Jacobian determinant of T(U(ξ))T(U(\xi)) is:

∣JT∘U(ξ)∣=∣JT(U(ξ))∣⋅∣JU(ξ)∣ |\mathbf{J_{T\circ U}}(\xi)| = |\mathbf{J_T}(U(\xi))|\cdot|\mathbf{J_U}(\xi)|

Common domains and their volumes

For all bijective mappings, we know that:

vol(Ω)=∫Ξ∣JT(ξ)∣dξ \mathrm{vol}(\Omega) = \int_\Xi |\mathbf{J_T}(\xi)| d\xi

This is useful as a quick check for validating that the Jacobian determinant is correctly derived.

∣JT∣|\mathbf{J_T}| Catalogue

Any equal-area projection

For equal-area projections specifically, the Jacobian determinant is constant:

∣JT∣=vol(Ω)vol(Ξ) |\mathbf{J_T}| = \frac{\mathrm{vol}(\Omega)}{\mathrm{vol}(\Xi)}

You can look up the volumes for the domains of your equal-area projection from the previous section and plug them into the above equation.

This category includes many popular mappings such as Lambert cylindrical equal-area projection, Lambert azimuthal equal-area projection, HEALPix, Clarberg's equal-area octahedral mapping / Collignon quincuncial [1]. When you use these projections to map from the unit square [0,1]2[0,1]^2 to a 3D unit vector, ∣JT∣=4π|\mathbf{J_T}| = 4\pi.

Equirectangular projection

Here, Ξ\Xi is the unit square and Ω\Omega is the unit sphere. It goes something like below, but there's lots of options depending on which axis you choose for the north-south direction and where you want ξ1\xi_1 and ξ2\xi_2 to map:

T(ξ)=[cos⁡(2πξ1)⋅sin⁡(πξ2)cos⁡(πξ2)sin⁡(2πξ1)⋅sin⁡(πξ2)]T−1(ω)=[12π(π−atan2(ω3,−ω1))1πcos⁡−1(ω2)] \begin{align*} T(\xi) &= \begin{bmatrix} \cos(2 \pi \xi_1) \cdot \sin(\pi \xi_2) \\ \cos(\pi \xi_2) \\ \sin(2 \pi \xi_1) \cdot \sin(\pi \xi_2) \\ \end{bmatrix} \\ T^{-1}(\omega) &= \begin{bmatrix} \frac{1}{2\pi}(\pi-\mathrm{atan2}(\omega_3, -\omega_1))\\ \frac{1}{\pi}\cos^{-1}(\omega_2) \end{bmatrix} \end{align*}

Here, ξ2=0\xi_2 = 0 is the north pole and ξ2=1\xi_2 = 1 is the south pole, and the Y axis is the north-south direction. For this mapping,

∣JT(ξ)∣=2π2sin⁡(π⋅ξ2)∣JT−1(ω)∣=12π21−ω22 \begin{align*} |\mathbf{J_T}(\xi)| &= 2\pi^2\sin(\pi \cdot \xi_2) \\ |\mathbf{J_T^{-1}}(\omega)| &= \frac{1}{2\pi^2\sqrt{1 - \omega_2^2}} \end{align*}
Gnuplot Produced by GNUPLOT 6.0 patchlevel 5 gnuplot_plot_1 gnuplot_plot_2 0 0.2 0.4 0.6 0.8 1 ξ1 0 0.2 0.4 0.6 0.8 1 ξ2 0 5 10 15 20 |JT| 0 2 4 6 8 10 12 14 16 18 20
3D surface plot of ∣JT(ξ)∣|\mathbf{J_T}(\xi)|

I presented the derivation for this in the previous Jacobian post.

Octahedral projection

Here, Ξ\Xi is the unit square and Ω\Omega is the unit sphere. This non-equal-area octahedral projection [2] is widely used in light probes, e.g. in DDGI [3]. It is also used for encoding normal vectors into two numbers [4].

u=2ξ1−1v=2ξ2−1Q(ξ)=[u−sgn(u)max⁡(∣u∣+∣v∣−1,0)v−sgn(v)max⁡(∣u∣+∣v∣−1,0)1−∣u∣−∣v∣]T(ξ)=Q(ξ)∣Q(ξ)∣T−1(ω)=1∣ω1∣+∣ω2∣+∣ω3∣[ω1−sgn(ω1)min⁡(ω3,0)ω2−sgn(ω2)min⁡(ω3,0)]⋅12+12 \begin{align*} u &= 2\xi_1 - 1 \\ v &= 2\xi_2 - 1 \\ Q(\xi) &= \begin{bmatrix} u - \mathrm{sgn}(u) \max(|u| + |v| - 1, 0) \\ v - \mathrm{sgn}(v) \max(|u| + |v| - 1, 0) \\ 1 - |u| - |v| \\ \end{bmatrix} \\ T(\xi) &= \frac{Q(\xi)}{|Q(\xi)|} \\ T^{-1}(\omega) &= \frac{1}{|\omega_1|+|\omega_2|+|\omega_3|} \begin{bmatrix} \omega_1 - \mathrm{sgn}(\omega_1) \min(\omega_3, 0) \\ \omega_2 - \mathrm{sgn}(\omega_2) \min(\omega_3, 0) \end{bmatrix}\cdot\frac{1}{2} + \frac{1}{2} \end{align*}

The Jacobian determinant is then: [5]

∣JT(ξ)∣=4(1+2⋅min(1−∣u∣−∣v∣,0)+2u2+2v2−2∣u∣−2∣v∣+2∣uv∣)32∣JT−1(ω)∣=14(∣ω1∣+∣ω2∣+∣ω3∣)3 \begin{align*} |\mathbf{J_T}(\xi)| &= \frac{4}{(1+2\cdot\textrm{min}(1-|u|-|v|, 0)+2u^2+2v^2-2|u|-2|v|+2|uv|)^{\frac{3}{2}}} \\ |\mathbf{J_{T^{-1}}}(\omega)| &= \frac{1}{4 (|\omega_1|+|\omega_2|+|\omega_3|)^3} \end{align*}
Gnuplot Produced by GNUPLOT 6.0 patchlevel 5 gnuplot_plot_1 gnuplot_plot_2 0 0.2 0.4 0.6 0.8 1 ξ1 0 0.2 0.4 0.6 0.8 1 ξ2 0 2 4 6 8 10 12 |JT| 4 5 6 7 8 9 10 11 12
3D surface plot of ∣JT(ξ)∣|\mathbf{J_T}(\xi)|.

If we instead were to use Ξ=[−1,1]2\Xi = [-1, 1]^2, the factor of 4 would disappear from the determinant and you could replace u=ξ1u = \xi_1 and v=ξ2v = \xi_2.

Planar perspective projection

Here, Ξ\Xi is the unit square and Ω\Omega is the solid angle subtended by the image plane.

Q(ξ)=[2aξ1−a2ξ2−11tan⁡(α2)]T(ξ)=Q(ξ)∣Q(ξ)∣T−1(ω)=12ω3tan⁡(α2)[ω1aω2]+12 \begin{align*} Q(\xi) &= \begin{bmatrix} 2a\xi_1-a \\ 2\xi_2-1 \\ \frac{1}{\tan(\frac{\alpha}{2})} \end{bmatrix} \\ T(\xi) &= \frac{Q(\xi)}{|Q(\xi)|} \\ T^{-1}(\omega) &= \frac{1}{2\omega_3 \tan\left(\frac{\alpha}{2}\right)} \begin{bmatrix} \frac{\omega_1}{a} \\ \omega_2 \end{bmatrix}+ \frac{1}{2} \end{align*}

where aa is the aspect ratio (widthheight\frac{\mathrm{width}}{\mathrm{height}}) and α\alpha is the vertical field-of-view in radians.

∣JT(ξ)∣=4atan⁡(α2)⋅∣Q(ξ)∣3∣JT−1(ω)∣=14atan⁡(α2)2ω33 \begin{align*} |\mathbf{J_T}(\xi)| &= \frac{4a}{\tan(\frac{\alpha}{2})\cdot\left|Q(\xi)\right|^3} \\ |\mathbf{J_{T^{-1}}}(\omega)| &= \frac{1}{4 a \tan(\frac{\alpha}{2})^2 \omega_3^3} \end{align*}
Gnuplot Produced by GNUPLOT 6.0 patchlevel 5 gnuplot_plot_1 gnuplot_plot_2 0 0.2 0.4 0.6 0.8 1 ξ1 0 0.2 0.4 0.6 0.8 1 ξ2 0 1 2 3 4 5 6 |JT| 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
3D surface plot of ∣JT(ξ)∣|\mathbf{J_T}(\xi)|, with a=169a = \frac{16}{9}, α=80°\alpha = 80\degree

Cubemap

Here, Ξ\Xi is the unit square and Ω\Omega is one face of the cubemap.

Q(ξ)=[2ξ1−12ξ2−11]T(ξ)=Q(ξ)∣Q(ξ)∣T−1(ω)=12ω3[ω1ω2]+12 \begin{align*} Q(\xi) &= \begin{bmatrix} 2\xi_1-1 \\ 2\xi_2-1 \\ 1 \end{bmatrix} \\ T(\xi) &= \frac{Q(\xi)}{|Q(\xi)|} \\ T^{-1}(\omega) &= \frac{1}{2\omega_3}\begin{bmatrix} \omega_1 \\ \omega_2 \end{bmatrix} + \frac{1}{2} \end{align*}

This is derived essentially as a special case of the planar perspective projection, with aspect ratio a=1a = 1 and FOV α=π2\alpha = \frac{\pi}{2}.

∣JT(ξ)∣=4∣Q(ξ)∣3∣JT−1(ω)∣=14ω33 \begin{align*} |\mathbf{J_T}(\xi)| &= \frac{4}{|Q(\xi)|^3} \\ |\mathbf{J_{T^{-1}}}(\omega)| &= \frac{1}{4\omega_3^3} \end{align*}
Gnuplot Produced by GNUPLOT 6.0 patchlevel 5 gnuplot_plot_1 gnuplot_plot_2 0 0.2 0.4 0.6 0.8 1 ξ1 0 0.2 0.4 0.6 0.8 1 ξ2 0 0.5 1 1.5 2 2.5 3 3.5 4 |JT| 1 1.5 2 2.5 3 3.5 4
3D surface plot of ∣JT(ξ)∣|\mathbf{J_T}(\xi)|

Triangle point to unit vector

Here, Ξ\Xi is the unit square and Ω\Omega is the solid angle subtended by a triangle with corners AA, BB, CC.

Q(ξ)=(1−ξ1)ξ0⋅A+(1−ξ0)⋅B+ξ1ξ0⋅CT(ξ)=Q(ξ)∣Q(ξ)∣ \begin{align*} Q(\xi) &= (1 - \xi_1) \sqrt{\xi_0} \cdot A + (1 - \sqrt{\xi_0}) \cdot B + \xi_1\sqrt{\xi_0} \cdot C \\ T(\xi) &= \frac{Q(\xi)}{|Q(\xi)|} \end{align*}

where QQ is a point on the triangle. [6]

∣JT(ξ)∣=∣(A−B)×(A−C)⋅Q(ξ)∣2∣Q(ξ)∣3 |\mathbf{J_T}(\xi)| = \frac{|(A-B) \times (A-C) \cdot Q(\xi)|}{2|Q(\xi)|^3}

Note that the surface area of the triangle is S=∣(A−B)×(A−C)∣2S = \frac{|(A-B) \times (A-C)|}{2} and its normal vector is n=(A−B)×(A−C)∣(A−B)×(A−C)∣n = \frac{(A-B) \times (A-C)}{|(A-B) \times (A-C)|}. Therefore, we can also express ∣JT(ξ)∣|\mathbf{J_T}(\xi)| as:

∣JT(ξ)∣=S⋅∣n⋅Q(ξ)∣∣Q(ξ)∣3 |\mathbf{J_T}(\xi)| = S \cdot \frac{|n \cdot Q(\xi)|}{|Q(\xi)|^3}

The inverse is a bit more awkward, as it involves ray casting. Remember that ω=T(ξ)\omega = T(\xi), so:

Q=ω⋅∣Q∣ Q = \omega \cdot |Q|

where ∣Q∣|Q| is the "hit distance" that can be recovered by tracing a ray along ω\omega. Once you have that determined, the rest is easy:

∣JT−1(ω)∣=∣Q∣3S∣n⋅(ω⋅∣Q∣)∣=∣Q∣2S∣n⋅ω∣ |\mathbf{J_{T^{-1}}}(\omega)| = \frac{|Q|^3}{S|n \cdot (\omega \cdot |Q|)|} = \frac{|Q|^2}{S|n \cdot \omega|}

Surface point to unit vector

Here, Ξ\Xi is the surface, ξ\xi is a point on that surface and Ω\Omega is the solid angle subtended by that surface. This is a generalization of the above point-on-triangle case:

∣JT(ξ)∣=∣n⋅ξ∣∣ξ∣3 |\mathbf{J_T}(\xi)| = \frac{|n \cdot \xi|}{|\xi|^3}

Note that the SS in the point-on-triangle case is actually the Jacobian determinant of Q(ξ)Q(\xi), as it is an equal-area mapping: ∣JQ∣=Svol([0,1]2)=S|J_Q| = \frac{S}{vol([0,1]^2)} = S. We do not include it here because we already start from a point on the surface (instead of starting from the unit square).

If we notate r=∣ξ∣r = |\xi| and ∣cos⁡θ∣=∣n⋅ξ∣ξ∣∣|\cos\theta| = |n \cdot \frac{\xi}{|\xi|}|:

∣JT(ξ)∣=∣cos⁡θ∣r2 |\mathbf{J_T}(\xi)| = \frac{|\cos\theta|}{r^2}

which is the form that is listed in PBRT.

The inverse is also similar to the triangle case and requires recovering ∣ξ∣|\xi| by ray tracing.

∣JT−1(ω)∣=∣ξ∣2∣n⋅ω∣ |\mathbf{J_{T^{-1}}}(\omega)| = \frac{|\xi|^2}{|n \cdot \omega|}

This mapping and its inverse also appear in ReSTIR GI [7], where they are chained together so that we can compute the Jacobian determinant for when ξ\xi is being spatially offset (= viewed from different origins).

Didn't find what you were looking for?

Alright, here's the "teach a man to fish" section. You can usually find Jacobian determinants quite easily with the help of Sympy:

from sympy import *

r, u, v = symbols('r u v', real=True)

T = [
    r * cos(2*pi*u) * sin(pi*v),
    r * cos(pi*v),
    r * sin(2*pi*u) * sin(pi*v)
]
J = Matrix(T).jacobian((r,u,v))
JT = simplify(J.det())
print(JT)

You may have to apply some elbow grease to rewrite the Jacobian into a form that is intuitive or more efficient to evaluate.

If you are using Slang, you may not have to derive Jacobian determinants yourself, automatic differentiation can usually do that for you (although it may not be as well optimized).


  1. Petrik Clarberg. "Fast Equal-Area Mapping of the (Hemi)Sphere using SIMD". 2008. ↩︎

  2. Quirin Meyer et al. "On Floating-Point Normal Vectors". 2010. ↩︎

  3. Zander Majercik et al. "Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields". 2019. ↩︎

  4. Zina H. Cigolle et al. "Survey of Efficient Representations for Independent Unit Vectors". 2014. ↩︎

  5. Julius Ikkala et al. "RCPG: Real-Time Product Path Guiding Using Radiance Cascades". 2026. ↩︎

  6. Peter Shirley et al. "Sample Transformations Zoo". 2019. ↩︎

  7. Yaobin Ouyang et al. "ReSTIR GI: Path Resampling for Real-Time Path Tracing". 2021. ↩︎