add notes on pow's use in 3D graphics
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 11 Apr 2023 06:07:08 +0000 (23:07 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Tue, 11 Apr 2023 06:07:08 +0000 (23:07 -0700)
openpower/transcendentals.mdwn

index 86edb7f306bd6f43688180bcc42c93164a8b6be6..9e6b86118b1f2687e3a14d18851165041faa155b 100644 (file)
@@ -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]]