From d5f837fe00e4f3c9efaeca49fdbb29a0c11fe0df Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 10 Apr 2023 23:07:08 -0700 Subject: [PATCH] add notes on pow's use in 3D graphics --- openpower/transcendentals.mdwn | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openpower/transcendentals.mdwn b/openpower/transcendentals.mdwn index 86edb7f30..9e6b86118 100644 --- a/openpower/transcendentals.mdwn +++ b/openpower/transcendentals.mdwn @@ -436,6 +436,11 @@ CBRT, POW, POWN, POWR, ROOTN These are simply much more complex to implement in hardware, and typically will only be put into HPC applications. +Note that `pow` is commonly used in Blinn-Phong shading (the shading model used +by OpenGL 1.0 and commonly used by shader authors that need basic 3D graphics +with specular highlights), however it can be sufficiently emulated using +`pow(b, n) = exp2(n*log2(b))`. + * **Zfrsqrt**: Reciprocal square-root. ## Trigonometric subsets @@ -529,6 +534,10 @@ high-performance or correctly-rounding): ASINH( x ) = ln( x + SQRT(x**2+1)) +`pow` sufficient for 3D Graphics: + + pow(b, x) = exp2(x * log2(b)) + # Evaluation and commentary Moved to [[discussion]] -- 2.30.2