From 6c8a113c7416056ea8c404307f15e9f6c3db3b28 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 7 Aug 2026 02:23:06 -0700 Subject: water plan also add local mode to build script, and fix the template's title issue (would say index; now says the title). --- index.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- make_html | 15 ++++++++++-- template.html | 38 ++++++------------------------ 3 files changed, 94 insertions(+), 34 deletions(-) diff --git a/index.md b/index.md index 3c47448..48d90cb 100755 --- a/index.md +++ b/index.md @@ -1,7 +1,80 @@ --- -pagetitle: yummers +title: yummers lang: en --- +# fft water: the plan {data-date="7 Aug 2026"} + +About a year ago I took a stab at reimplementing Tessendorf's ocean +water[^tessendorf]. I got some decent results, but the implementation was +sloppy and not particularly organized. I also never implemented Bruneton's +"geometry to BRDF" method [^bruneton], partially because the implementation was +sloppy. + +I've gotten the itch to take another stab at implementing this water +system. This time, I will try harder to proceed along principled, logical +steps, and check my work more thoroughly along the way. + +I've also decided to document this process. I expect it to take a few months to +complete this project. Hopefully in the future, these notes might help someone +trying to implement some nice deep-ocean water in their engine/game/whatever. + +I'll implement this renderer as follows (this list is likely to change): + +* Derive a high-performance GPU-based FFT implementation on CPU. + * Check against a simple reference implementation of Cooley-Tukey. +* Measure the impact of radix on the numerical precision of the FFT. + * Ideally, generate some graphs. + * Also look at the impact of float precision - 8-bit, 16-bit, etc. +* Implement this FFT algorithm in slang + webGPU. Render unlit. Measure + performance. + * Implement image export from webGPU harness. Measure error - verify that it + matches expectations. +* Generate a wave energy spectrum using Horvath's viscous shallow water wave + dispersion relation. +* Generate one frame of wave displacement using slang + webGPU. + * Validate feature scale, energy, etc. You probably want some histograms. +* Generate one frame of analytic normals using slang + webGPU. + * Validate using finite differences of the heightmap as an approximation of + ground truth. The two images should match within some small epsilon. +* Generate chop and chop normals. + * Validate feature size and normals using finite differences (again). +* Implement stdev (per geometry-to-brdf paper). + * (Note to self: this is a static image based on the energy spectrum. We + calculate the ddx/ddy of the offset [meters/px], then divide 2 \* pi by + that number to get a wave number. That is then used as the index to the + LUT. The LUT contains, for each wave number, the sum of the variances of + all waves with higher or equal wave numbers.) +* Render a simple scene in webGPU and in Mitsuba 3. + * Implement a simple brdf. + * Implement frame export. + * Implement image diffing / measurement. + * Implement hard shadows. + * Implement soft shadows. + * Validate point lighting. + * Validate directional lighting. + * Implement and validate IBL. + * Implement and validate DFG LUT (energy-preserving roughness). + * Implement vertex deformation and normals using baked heightmap & tangents. + Validate against Mitsuba. + * Make a new scene with a highly subdivided quad. +* Port to Unity. + * Implement tooling to blit a texture through a RenderTexture using a shader. + * Automation should generate quads, materials, and rendertextures on behalf + of the user. + * Port compute shader to shaderlab pixel shader. Validate. + * Port lit shader to shaderlab. + * Sample scene, frame export, exhaustive validation... the works. + * Validate point, directional, and IBL. + * Add light volumes. + * Add LTCGI. + +So... yeah. A lot of work. I'll get started tomorrow! + +--- + +[^tessendorf]: Tessendorf, Jerry. *Simulating Ocean Water*. 2004. [PDF](https://people.computing.clemson.edu/~jtessen/reports/papers_files/coursenotes2004.pdf). +[^bruneton]: Bruneton, Eric et. al. *Real-time Realistic Ocean Lighting using Seamless Transitions from Geometry to BRDF*. 2010. [PDF](https://inria.hal.science/inria-00443630/PDF/article-1.pdf). + # how do you evenly tile a column? {data-date="12 Jul 2026"} While walking through town the other day, I saw a pillar that looks a bit like this: diff --git a/make_html b/make_html index fe42448..fdc8133 100755 --- a/make_html +++ b/make_html @@ -2,13 +2,18 @@ MARKDOWN_IN="$1" [ -z "$MARKDOWN_IN" ] && { echo "Script requires one markdown argument."; exit 1; } +if [ $# -eq 2 ]; then + LOCAL_MODE=1 +fi set -o errexit set -o xtrace OUTPUT_DIR="site_generated" -[ -d "$OUTPUT_DIR" ] && rm -r "$OUTPUT_DIR" -mkdir "$OUTPUT_DIR" +[ ! $LOCAL_MODE ] && [ -d "$OUTPUT_DIR" ] && rm -r "$OUTPUT_DIR" +if [ ! -d "$OUTPUT_DIR" ]; then + mkdir "$OUTPUT_DIR" +fi pandoc \ --mathml \ @@ -20,6 +25,12 @@ pandoc \ -o "$OUTPUT_DIR/site.zip" \ "$MARKDOWN_IN" +if [ $# -eq 2 ]; then + # Local mode + unzip -o "$OUTPUT_DIR/site.zip" -d "$OUTPUT_DIR" + exit +fi + unzip -o "$OUTPUT_DIR/site.zip" -d /var/www/html/ cp -r vr_assets /var/www/html/ cp -r images /var/www/html/ diff --git a/template.html b/template.html index a0cfc1a..7567942 100755 --- a/template.html +++ b/template.html @@ -104,6 +104,13 @@ $endif$ color: var(--foreground-color); border-left: 4px solid var(--current-line-color); } + /* numbered citations rendered from Markdown footnotes */ + .footnote-ref sup { + font-size: inherit; + vertical-align: baseline; + } + .footnote-ref sup::before { content: "["; } + .footnote-ref sup::after { content: "]"; } ::selection { background-color: var(--selection-color); } @@ -160,26 +167,6 @@ $endif$ $for(include-before)$ $include-before$ $endfor$ -$if(title)$ -
-

$title$

- $if(subtitle)$ -

$subtitle$

- $endif$ - $for(author)$ -

$author$

- $endfor$ - $if(date)$ -

$date$

- $endif$ - $if(abstract)$ -
-
$abstract-title$
- $abstract$ -
- $endif$ -
-$endif$ $if(top)$ $body$

back to main page

@@ -202,17 +189,6 @@ $else$ be able to quickly assess quality regardless of how the code is made.

- core beliefs: -

    -
  1. information should be free;
  2. -
  3. human-caused climate change is real, significant, and solvable;
  4. -
  5. passive acceptance of cruelty is complicity;
  6. -
  7. trans rights are human rights;
  8. -
  9. the web is a vast sea made of individuals with feelings;
  10. -
  11. your actions matter.
  12. -
-

-

links: