From aca7150c9e1fbc697aab1d5a3e0b95b90d16d83f Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 25 Aug 2026 01:32:47 -0400 Subject: [PATCH] 1875582899996782889 --- ...ts-pretty-amazing-how-good-the-hastings.md | 35 ++++++++++ ...king-at-a-very-similar-problem-for-hemi.md | 35 ++++++++++ .../index.md | 69 +++++++++++++++++++ archive/threads/NOTimothyLottes/index.md | 1 + 4 files changed, 140 insertions(+) create mode 100644 archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-04-marc_b_reynolds-its-pretty-amazing-how-good-the-hastings.md create mode 100644 archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-06-pixelmager-i-was-looking-at-a-very-similar-problem-for-hemi.md create mode 100644 archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/index.md diff --git a/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-04-marc_b_reynolds-its-pretty-amazing-how-good-the-hastings.md b/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-04-marc_b_reynolds-its-pretty-amazing-how-good-the-hastings.md new file mode 100644 index 0000000..59ba1ed --- /dev/null +++ b/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-04-marc_b_reynolds-its-pretty-amazing-how-good-the-hastings.md @@ -0,0 +1,35 @@ +--- +title: "@NOTimothyLottes It's pretty amazing how good the Hastings approximations still are." +type: archive +source: twitter +source_url: "https://x.com/marc_b_reynolds/status/1875646616818139275" +author: "Marc B. Reynolds" +handle: marc_b_reynolds +post_id: "1875646616818139275" +date: 2025-01-04 +archived: 2026-08-25 +draft: false +tags: + - archive + - twitter + - NOTimothyLottes +description: "@NOTimothyLottes It's pretty amazing how good the Hastings approximations still are." +in_reply_to: "" +parent_post_id: "1875589737282679108" +--- + +## Source + +- URL: https://x.com/marc_b_reynolds/status/1875646616818139275 +- Author: Marc B. Reynolds (@marc_b_reynolds) +- Posted: 2025-01-04 20:52:55 + +## Branch + +**1/** + +@NOTimothyLottes It's pretty amazing how good the Hastings approximations still are. I'd note that they are designed for minimizing absolute error which isn't what you'd want for general purpose usage but it's the right answer for "all angles are equally important" problems. + +## Related + +- Spine: [[archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs]] diff --git a/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-06-pixelmager-i-was-looking-at-a-very-similar-problem-for-hemi.md b/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-06-pixelmager-i-was-looking-at-a-very-similar-problem-for-hemi.md new file mode 100644 index 0000000..548c90b --- /dev/null +++ b/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-06-pixelmager-i-was-looking-at-a-very-similar-problem-for-hemi.md @@ -0,0 +1,35 @@ +--- +title: "@NOTimothyLottes I was looking at a very similar problem for hemi-octahedrons recently." +type: archive +source: twitter +source_url: "https://x.com/pixelmager/status/1876239280529633476" +author: "Mikkel Gjoel" +handle: pixelmager +post_id: "1876239280529633476" +date: 2025-01-06 +archived: 2026-08-25 +draft: false +tags: + - archive + - twitter + - NOTimothyLottes +description: "@NOTimothyLottes I was looking at a very similar problem for hemi-octahedrons recently." +in_reply_to: "" +parent_post_id: "1875589737282679108" +--- + +## Source + +- URL: https://x.com/pixelmager/status/1876239280529633476 +- Author: Mikkel Gjoel (@pixelmager) +- Posted: 2025-01-06 12:07:57 + +## Branch + +**1/** + +@NOTimothyLottes I was looking at a very similar problem for hemi-octahedrons recently. I definitely need to revisit in the context of this EAM paper, I ended up with a pretty slow polar-coordinate-remapping instead to move precision to the horizon https://www.shadertoy.com/view/wsBXzD + +## Related + +- Spine: [[archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs]] diff --git a/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/index.md b/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/index.md new file mode 100644 index 0000000..4cd3b3c --- /dev/null +++ b/archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/index.md @@ -0,0 +1,69 @@ +--- +title: "For the love of octahedrons: https://fileadmin.cs.lth.se/graphics/research/papers/2008/simdmapping/clarberg_simdmapping08_preprint.pdf" +type: archive +source: twitter +source_url: "https://x.com/NOTimothyLottes/status/1875582899996782889" +author: "NOTimothyLottes" +handle: NOTimothyLottes +post_id: "1875582899996782889" +date: 2025-01-04 +archived: 2026-08-25 +draft: false +tags: + - archive + - twitter + - NOTimothyLottes +description: "For the love of octahedrons: https://fileadmin.cs.lth.se/graphics/research/papers/2008/simdmapping/clarberg_simdmapping08_preprint.pdf" +in_reply_to: "" +--- + +## Source + +- URL: https://x.com/NOTimothyLottes/status/1875582899996782889 +- Author: NOTimothyLottes (@NOTimothyLottes) +- Posted: 2025-01-04 16:39:44 + +## Thread + +**1/** + +For the love of octahedrons: https://fileadmin.cs.lth.se/graphics/research/papers/2008/simdmapping/clarberg_simdmapping08_preprint.pdf + +Mapping this well to the GPU follows ... + +![](https://pbs.twimg.com/media/GgdoSaxXYAAwbTz?format=png&name=orig) + +**2/** + +At some point the standard Octahedron mapping leaves a lot to be desired due to highly variable texel sizing, so have been using that paper's equal area mapping instead. Spent some time optimizing today, got to this which is in theory just 31ops for the 2D to 3D transform + +![](https://pbs.twimg.com/media/GgdpMDiXMAEEL8y?format=png&name=orig) + +**3/** + +AMD's latest driver actually does mostly a good job compiling that (32 op clocks compiled, just 1 more instruction somewhere). I'm surprised actually it's now picking up 'cos(x*2pi)' and pattern matching that to just V_COS_F32! + +![](https://pbs.twimg.com/media/Ggdp6iCWcAAYubj?format=png&name=orig) + +**4/** + +And the inverse which should also be around 32 op clk (VALU). This uses the Horner form for the papers atan approximation. Could perhaps make that less or more accurate if desired. + +![](https://pbs.twimg.com/media/GgdrTPnWYAABHUm?format=png&name=orig) + +**5/** + +AMD's compiler also does a good job there. + +![](https://pbs.twimg.com/media/GgdrucxXQAAPQfe?format=png&name=orig) + +**6/** + +If AMD evolved to a fused floating point compare and select instead of a separate V_CMP* and V_CNDMASK_B32, it would shave a few cycles. Also if they could push 2 results into a result cache in 1 clk, doing the MIN and MAX in one op would shave a cycle. + +**7/** + +Related> Great ref for fast atan2: https://mazzo.li/posts/vectorized-atan2.html +I'm using the simplest form from the 1955 paper in horner form scaled by /pi for cylindrical view projection code + +Branches: [[archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-04-marc_b_reynolds-its-pretty-amazing-how-good-the-hastings]], [[archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs/2025-01-06-pixelmager-i-was-looking-at-a-very-similar-problem-for-hemi]] diff --git a/archive/threads/NOTimothyLottes/index.md b/archive/threads/NOTimothyLottes/index.md index c1d2d84..903a8fa 100644 --- a/archive/threads/NOTimothyLottes/index.md +++ b/archive/threads/NOTimothyLottes/index.md @@ -40,6 +40,7 @@ tags: - [[archive/threads/NOTimothyLottes/2024-12-16-also-i-wouldnt-just-modify-an-existing-compiler]] - [[archive/threads/NOTimothyLottes/2024-12-16-then-there-are-rough-edges-to-texel-buffer]] - [[archive/threads/NOTimothyLottes/2024-12-21-not-sure-if-this-is-the-end-of-this-story-yet-but]] +- [[archive/threads/NOTimothyLottes/2025-01-04-for-the-love-of-octahedrons-https-fileadmin-cs]] - [[archive/threads/NOTimothyLottes/2025-01-26-often-overlooked-aspect-of-gpu-perf-scaling]] - [[archive/threads/NOTimothyLottes/2025-04-16-cs-optimization-brain-dumping]] - [[archive/threads/NOTimothyLottes/2025-04-30-3-i-got-side-tracked-by-building-a-language-that]]