All Posts

Most Recent Posts:
2024-03-17 What I wish I knew about ESPP and RSUs sooner (company stock benefits. 2024, USA, California)
2024-02-11 Gradient Descent With Adam in Plain C++
2023-12-24 Making Blue Noise Point Sets With Sliced Optimal Transport
2023-11-24 Interpolating Color Image Histograms Using Sliced Optimal Transport
2023-10-22 How To Make Your Own Spooky Magic Eye Pictures (Autostereograms)
2023-10-20 When There Are Too Many Experiments (Tests) To Do! Part 2: Orthogonal Arrays
2023-10-17 Fractional Factorial Experiment Design: When There Are Too Many Experiments To Do
2023-09-18 Alan Wolfe (Atrix256/Demofox) Banned (?) From X (Twitter)

258 posts grouped by the following categories:

(Posts TODO – to help me remember things I’d like to write up at some point https://blog.demofox.org/2018/11/22/posts-todo/)

Other Publications

EA SEED Blog Posts and Presentations
2024-01-17 Machine Learning for Game Developers (Youtube, 45 minutes)
2024-01-17 Machine Learning for Game Devs: Part 3
2023-11-17 Machine Learning for Game Devs: Part 2
2023-10-30 Machine Learning for Game Devs: Part 1
2023-09-06 Constant Time Stateless Shuffling and Grouping

Spatiotemporal Blue Noise Masks – EGSR 2022
EGSR 2022 Presentation (Youtube): https://www.youtube.com/watch?v=4nM2FbLnOqQ
EGSR 2022 Paper: https://diglib.eg.org/handle/10.2312/sr20221161
Code and pregenerated textures: https://github.com/NVIDIAGameWorks/SpatiotemporalBlueNoiseSDK
NVIDIA Blog post part 1: https://developer.nvidia.com/blog/rendering-in-real-time-with-spatiotemporal-blue-noise-textures-part-1/
NVIDIA Blog post part 2: https://developer.nvidia.com/blog/rendering-in-real-time-with-spatiotemporal-blue-noise-textures-part-2/
Arxiv Paper on scalar valued STBN: https://arxiv.org/abs/2112.09629

Ray Tracing Gems II – 2021
2021-08-04 Ray Tracing Gems II Chapter 24 “Using Blue Noise for Ray Traced Soft Shadows”

Simple But Effective Verlet Game Physics – GDC India 2021
Slides: https://drive.google.com/drive/folders/1D_ZNhz_LRYHLUuDYY3-ge6cP0CSfTfc_
Youtube Video: https://www.youtube.com/watch?v=zfkaMWIo3XM

Graphics

2023-12-24 Making Blue Noise Point Sets With Sliced Optimal Transport
2023-11-24 Interpolating Color Image Histograms Using Sliced Optimal Transport
2023-10-22 How To Make Your Own Spooky Magic Eye Pictures (Autostereograms)
2022-02-26 Image Sharpening Convolution Kernels
2022-02-01 Two Low Discrepancy Grids: Plus Shaped Sampling LDG, and R2 LDG
2022-01-01 Interleaved Gradient Noise: A Different Kind of Low Discrepancy Sequence
2021-12-29 Why Can’t You Design Noise in Frequency Space?
2021-12-27 Not All Blue Noise is Created Equal Part 2
2021-04-11 Perlin Noise Experiments
2020-11-04 Frequency Domain Image Compression and Filtering
2020-07-11 Interpolating Data Over Arbitrary Shapes With Laplace’s Equation and Walk on Spheres
2020-06-14 Casual Shadertoy Path Tracing 3: Fresnel, Rough Refraction & Absorption, Orbit Camera
2020-06-06 Casual Shadertoy Path Tracing 2: Image Improvement and Glossy Reflections
2020-05-25 Casual Shadertoy Path Tracing 1: Basic Camera, Diffuse, Emissive
2020-05-16 Using Blue Noise For Raytraced Soft Shadows
2020-05-10 Ray Marching Fog With Blue Noise
2019-12-07 Bezier Triangles
2019-06-25 Generating Blue Noise Textures With Void And Cluster
2018-11-16 How To: Data Lookups Via Raytracing
2018-08-12 Not All Blue Noise is Created Equal
2018-08-07 Tiled Blue Noise
2018-07-13 Blending an HDR color into a U8 Buffer
2018-07-04 Pathtraced Depth of Field & Bokeh
2018-04-16 Prefix Sums and Summed Area Tables
2018-03-24 An Idea: Raytracing Lookup Tables
2018-03-19 A Very Quick DirectX Raytracing API Primer
2018-03-10 Don’t Convert sRGB U8 to Linear U8!
2018-01-30 What the Heck is Blue Noise?
2017-11-26 Dissecting “Tiny Clouds”
2017-11-03 Animating Noise For Integration Over Time 2: Uniform Over Time
2017-10-31 Animating Noise For Integration Over Time
2017-10-25 Transmuting White Noise To Blue, Red, Green, Purple
2017-10-20 Generating Blue Noise Sample Points With Mitchell’s Best Candidate Algorithm
2017-10-01 Calculating the Distance Between Points in “Wrap Around” (Toroidal) Space
2017-07-10 WebGL PBR Implementation
2017-07-01 Why Are Some Shadows Soft And Other Shadows Hard?
2017-01-09 Raytracing Reflection, Refraction, Fresnel, Total Internal Reflection, and Beer’s Law
2016-09-21 Path Tracing – Getting Started With Diffuse and Emissive
2016-07-28 Fourier Transform (And Inverse) Of Images
2016-03-14 Using Wang Tiles to Simulate Turing Machines
2016-03-05 Matrix Form of Bezier Curves
2016-03-02 Actually Making Signed Distance Field Textures With JFA
2016-02-29 Fast Voronoi Diagrams and Distance Field Textures on the GPU With the Jump Flooding Algorithm
2016-02-21 G-Buffer Upsizing
2016-02-03 Failed Shadertoy “Dust” Game – Browsers Need To Compile Shaders Off the Main Thread!
2016-01-16 Making a Ray Traced Snake Game in Shadertoy
2015-08-19 Gaussian Blur
2015-08-18 Box Blur
2015-08-15 Resizing Images With Bicubic Interpolation
2015-08-09 Cubic Hermite Rectangles
2015-06-19 What is Pre-multiplied Alpha and Why Does it Matter?
2015-04-30 Bilinear Filtering & Bilinear Interpolation
2015-04-23 FlipQuad & FlipTri Antialiasing
2015-04-23 4-Rook Antialiasing (RGSS)
2015-04-22 Quincunx Antialiasing
2015-01-17 Bresenham’s Drawing Algorithms
2014-08-13 Wang Tiling
2014-08-11 Temporal supersampling, flipquads and real time raytracing
2014-06-30 Distance Field Textures
2014-06-22 Analytic Fog Density
2014-02-07 Lots of Skyboxes!
2014-02-03 Converting RGB to Grayscale
2014-01-27 A trip through the Graphics Pipeline
2014-01-22 Shadertoy – WebGLSL pixel shaders
2012-09-25 How to Render the Mandelbrot Set
2012-05-03 MoriRT: Pixel and Geometry Caching to Aid Real Time Raytracing

Original Research / Inventions

2019-03-22 Linear Fit Search
2018-04-23 Taking a Stroll Between The Pixels
2017-05-07 Improved Storage Space Efficiency of GPU Texture Sampler Bezier Curve Evaluation
2016-12-16 Evaluating Points on Analytical Surfaces and in Analytical Volumes Using the GPU Texture Sampler
2016-12-10 Failed Experiment: The GPU Texture Sampler is Turing Complete But That Fact is Pretty Useless
2016-12-08 Evaluating Polynomials with the GPU Texture Sampler
2016-02-22 GPU Texture Sampler Bezier Curve Evaluation
2015-01-24 DAPSE Preview

Programming

2023-04-07 Random Sampling Experiments: Avoid The Sides!
2023-03-15 Euler’s Best Candidate – For Generating Blue Noise Sample Points, and More
2023-01-04 Generalizing Binary Search To Higher Dimensions
2022-10-30 Rapidly Solving Sudoku, N-Queens, Pentomino Placement, and More, With Knuth’s Algorithm X and Dancing Links.
2022-07-21 Rounding Modes For Integer Division
2020-10-25 When Life Gives You Lemons, Make Random Numbers
2020-06-23 Weighted Round Robin (Weighted Random Integers) Using The Golden Ratio Low Discrepancy Sequence
2019-08-10 Measuring Debug STL Container Perf Cost in MSVC
2017-11-21 Demystifying Floating Point Precision
2017-06-20 SIMD / GPU Friendly Branchless Binary Search
2016-12-06 The Secret to Writing Fast Code / How Fast Code Gets Slow
2016-11-13 Minimizing Code Complexity by Programming Declaratively
2016-10-14 A Data Point for MSVC vs Clang Code Generation
2016-10-03 Is Code Faster Than Data? Examining Hash Tables
2016-09-26 Is Code Faster Than Data? Switch Statements vs. Arrays
2016-09-23 Exploring Compile Time Hashing
2016-05-18 Who Cares About Dynamic Array Growth Strategies?
2016-04-09 Turning a Truth Table Into A digital Circuit (ANF)
2016-02-09 How and Why Cleaning Up Code or Processes Gives Multiplicative Benefits
2015-12-20 Simplifying Boolean Expressions With Karnaugh Maps
2015-12-18 What Happens When you Mix Hash Tables and Binary Searching?
2015-12-14 O(1) Data Lookups With Minimal Perfect Hashing
2015-03-09 HyperLogLog: Estimate Unique Value Counts Like The Pros
2015-02-25 Avoiding The Performance Hazzards of std::function
2015-02-22 Count Min Sketch: A Probabilistic Histogram
2015-02-13 Writing a Basic Search Engine AKA Calculating Similarity of Histograms with Dot Product
2015-02-08 Estimating Set Membership With a Bloom Filter
2015-02-05 Getting Strongly Typed Typedefs Using Phantom Types
2015-02-03 Estimating Counts of Distinct Values with KMV
2013-09-13 External C++ Header Guards
2013-09-09 Alloca and Realloc – Useful Tools, Not Ancient Relics
2013-07-08 Is pre-increment really faster than post increment? Part 2
2013-07-07 A Super Tiny Random Number Generator
2013-07-06 Fast & Lightweight Random “Shuffle” Functionality – FIXED!
2013-07-06 The Incredible Time Traveling Random Number Generator
2013-06-18 Why do you hate me rand()?!
2013-06-08 Fast & Lightweight Random “Shuffle” Functionality
2013-06-08 Efficiently Generate Random Numbers Without Repeats
2013-06-05 Is pre-increment really faster than post increment? Part 1
2013-05-21 The Black Art of sizeof() aka Compile Time Type Deduction
2013-05-11 Lists of Macro Lists
2013-05-07 Macro Lists For The Win – Side B
2013-05-03 Macro Lists For The Win
2013-05-01 Permutation Programming Without Maintenance Nightmares
2012-11-28 Mechanical Computer Quest Part I

Game Dev

2020-03-01 Using Low Discrepancy Sequences & Blue Noise in Loot Drop Tables for Games
2017-09-30 Half Tile Offset Streaming World Grids
2016-04-01 Game Development Needs Data Pipeline Middleware
2014-01-11 Getting Ideal Disk Reads on the Cheap
2012-09-24 Bias And Gain Are Your Friend
2012-09-21 Anatomy of a Skeletal Animation System Part 3
2012-09-21 Anatomy of a Skeletal Animation System Part 2
2012-09-21 Anatomy of a Skeletal Animation System Part 1
2012-09-09 Recording lagless demo videos of a laggy game

Math

2024-12-24 Deriving the Inverse CDF of a Rotated Square Projected onto a Line
2023-10-20 When There Are Too Many Experiments (Tests) To Do! Part 2: Orthogonal Arrays
2023-10-17 Fractional Factorial Experiment Design: When There Are Too Many Experiments To Do
2023-09-11 Generating Hamiltonian Cycles on Graphs with Prime Numbers of Nodes, Without Repeating Edges
2023-09-01 Sparse Pairwise Voting or Tournaments (Implementing SoME3 Voting)
2023-08-22 Permutation Iteration and Random Access
2023-08-21 Inverting Gauss’ Formula
2023-03-12 Euler’s Number & Probability
2023-03-06 Uniform 1D Red Noise & Blue Noise Part 2
2023-02-20 Uniform 1D Red Noise & Blue Noise
2023-02-17 Fibonacci Word Sampling: A Sorted Golden Ratio Low Discrepancy Sequence
2022-08-09 Calculating Discrete Sums With Umbral Calculus
2022-08-02 Calculating the Similarity of Histograms or PDFs & Interpolating Them Using the p-Wasserstein Distance
2022-07-12 Calculating SVD and PCA in C++
2022-07-10 Programming PCA From Scratch In C++
2022-06-29 Piecewise Least Squares Curve Fitting
2022-06-06 Fitting Data Points With Weighted Least Squares
2022-03-02 Sampling Importance Resampling
2022-03-01 Picking Fairly From A List of Unknown Size With Reservoir Sampling
2022-02-26 The Discrete Cosine Transform, and Derivatives
2022-02-20 Adjusting Point Sets in Frequency Space Using a Differentiable Fourier Transform
2022-01-29 Distance Between Points on a “Toroidal Disk”
2021-04-01 Mean Squared Error is Variance
2020-11-25 Multiple Importance Sampling in 1D
2020-07-26 Irrational Numbers
2020-07-17 Using Low Discrepancy Sequences With Rejection Sampling
2020-06-04 A Link Between Russian Roulette and Rejection Sampling / Importance Sampling
2020-05-03 Guess a Number Between 1 and 10
2020-03-17 Basic Methods For Finding Zeroes and Mins / Maxes of Functions
2020-03-12 Using White Noise to Choose Between Red Noise and Blue Noise
2020-03-10 How Do I Calculate Variance in 1 Pass?
2020-02-09 A Fun 2d Rotation Matrix Derivation
2019-12-01 Calculating Information Entropy
2019-10-25 Bayes’ Theorem Intuition
2019-07-30 Dice, Distributions & Noise Colors
2019-06-1 Taking the Max of Uniform Random Numbers
2019-05-25 Generating Random Numbers From a Specific Distribution With The Metropolis Algorithm (MCMC)
2018-06-12 Monte Carlo Integration Explanation in 1D
2017-08-08 Generating Random Numbers From a Specific Distribution With Rejection Sampling
2017-08-05 Generating Random Numbers From a Specific Distribution By Inverting the CDF
2017-07-25 Counting Bits & The Normal Distribution
2017-05-29 When Random Numbers Are Too Random: Low Discrepancy Sequences
2017-04-10 Solving N equations and N unknowns: The Fine Print (Gauss Jordan Elimination)
2017-03-31 Orthogonal Projection Matrix Plainly Explained
2017-03-13 Neural Network Gradients: Backpropagation, Dual Numbers, Finite Differences
2017-02-20 Multivariable Dual Numbers & Automatic Differentiation
2017-02-07 A Geometric Interpretation of Neural Networks
2017-01-02 Incremental Least Squares Surface and Hyper-Volume Fitting
2016-12-22 Incremental Least Squares Curve Fitting
2016-08-23 Incremental Averaging
2016-08-11 Understanding The Discrete Fourier Transform
2016-03-11 A Sixth Way To Calculate Sine Without Trig
2016-02-19 Normalized Vector Interpolation TL;DR
2015-11-13 Hiding a Lookup Table in a Modulus Operation
2015-09-15 Solving Nested Modulus Equations
2015-09-12 Solving Simultaneous Congruences (Chinese Remainder Theorem)
2015-09-10 Modular Multiplicative Inverse
2015-08-08 Cubic Hermite Interpolation
2015-08-05 Lagrange Rectangles
2015-08-02 Finite Differences
2015-07-28 Rectangular Bezier Patches
2015-07-08 Lagrange Interpolation
2015-07-05 The De Casteljau Algorithm for Evaluating Bezier Curves
2015-06-14 A Fifth Way to Calculate Sine Without Trig
2015-05-25 Easy Binomial Expansion & Bezier Curve Formulas
2015-01-24 Programmatically Calculating GCD and LCM
2014-12-30 Dual Numbers & Automatic Differentiation
2014-12-27 Using Imaginary Numbers To Rotate 2D Vectors
2014-11-04 Four Ways to Calculate Sine Without Trig
2014-08-28 One Dimensional Bezier Curves
2014-08-14 Counting in Binary is a Fractal
2014-08-10 What if My Equation DOESN’T Equal Zero??
2014-03-22 Bezier Curves Part 2 (and Bezier Surfaces)
2014-03-09 Implicit vs Parametric vs Explicit Surfaces
2014-03-04 Bezier Curves
2014-02-20 Soft Maximum vs Hard Maximum
2013-11-13 Transformation Matrix Basics
2013-10-12 Converting To and From Polar / Spherical Coordinates Made Easy
2013-09-17 How to Test Randomness of Numbers

Machine Learning

2024-02-11 Gradient Descent With Adam in Plain C++
2019-05-11 Markov Chain Text Generation
2017-12-23 C++ Differentiable Programming: Searching For An Optimal Dither Pattern
2017-03-15 Neural Network Recipe: Recognize Handwritten Digits With 95% Accuracy
2017-03-09 How to Train Neural Networks With Backpropagation
2012-10-23 B.A.M. Neural Networks

Cryptography

2016-10-19 Low Tech Homomorphic Encryption
2016-04-30 Shamir’s Quest: Collect Any 3 Keys To Unlock The Secret!
2015-09-05 Improving the Security of the Super Simple Symmetric Leveled Homomorphic Encryption Implementation
2015-09-05 Super Simple Symmetric Leveled Homomorphic Encryption Implementation
2014-05-18 Feistel Networks – Do They Have to use XOR?
2012-09-17 Encryption 101: Realistic Security
2012-09-16 Cryptography 101: Encryption – Asymmetric Keys
2012-09-15 Cryptography 101: Encryption – Symmetric Keys
2012-09-15 Cryptography 101: Encryption – One Time Pad
2012-09-12 Cryptography 101: Hashing

DSP

2020-01-24 IIR Audio & Data Filters – Featuring Biquads
2020-01-15 FIR Audio & Data Filters

Audio Synth / Audio Programming

2018-03-05 Granular Audio Synthesis
2016-07-01 Intro To Audio Synthesis For Music Presentation
2016-06-23 The Beating Effect
2016-06-16 Synthesizing a Plucked String Sound With the Karplus-Strong Algorithm
2015-04-19 Frequency Domain Audio Synthesis – With IFFT and Oscillators
2015-04-14 Decibels (dB) and Amplitude
2015-03-23 DIY Synth: Convolution Reverb & 1D Discrete Convolution of Audio Samples
2015-03-17 DIY Synth: Multitap Reverb
2015-03-17 DIY Synth: Delay Effect (Echo)
2015-03-16 DIY Synth: Flange Effect
2015-03-14 DIY Synth: Basic Drum
2012-06-18 DIY Synth 3: Sampling, Mixing, and Band Limited Wave Forms
2012-05-19 DIY Synth 2: Common Wave Forms
2012-05-14 DIY Synth 1: Sound Output

Quantum Programming

2015-11-06 Quantum Computing For Programmers Part 2: Multiple Qubits
2015-10-17 Quantum Computing For Programmers Part Ib: Bloch Sphere
2015-10-17 Quantum Computing For Programmers Part I: One Qubit
2015-10-12 Quantum Computing References

Network Programming

2018-6-04 A Neat Trick For Compressing Networked State Data

Soft Skills / Not Directly About Tech / Other

2024-03-17 What I wish I knew about ESPP and RSUs sooner (company stock benefits. 2024, USA, California)
2023-09-18 Alan Wolfe (Atrix256/Demofox) Banned (?) From X (Twitter)
2017-11-16 My Old Master: On Optimism
2017-07-03 A Tool To Debug Teams (Knoster)
2017-03-17 Plastic Bag Ban – Semi Reusable Bag Kiosks a Better Solution?
2017-01-24 My Old Master: How to Correct as a Mentor or a Teacher
2015-06-18 Adventures in Learning How to Publish a Research Paper Part 1
2015-05-24 No Bad Code, Creeping Normality and Social Structure Code Organization
2014-07-21 Situational Leadership

Electronics

2021-07-11 Inverting a Button Press (Featuring Current Dividers)
2021-06-27 Resistance and Voltage Dividers
2021-06-15 Voltage, Amps, Resistance and LEDs (Ohm’s Law)

Deriving the Inverse CDF of a Rotated Square Projected onto a Line

This goes along with the blog post for generating blue noise point sets using sliced optimal transport at https://blog.demofox.org/2023/12/24/making-blue-noise-point-sets-with-sliced-optimal-transport/ The code implementing this can be found on github at https://github.com/Atrix256/SOTPointSets/blob/main/squarecdf.h The diagrams in this post were made at https://www.geogebra.org/geometry I tried deriving this a few times, but kept getting a PDF that was more complex … Continue reading

Interpolating Color Image Histograms Using Sliced Optimal Transport

This post goes through a common exercise in applying optimal transport to graphics, using informal language and simple, standalone C++ to implement it. The post uses sliced optimal transport which compared to standard optimal transport solvers is more intuitive, more efficient, and makes for a simpler implementation. The code that goes with this post is … Continue reading