Find Related products on Amazon

Shop on Amazon

Procedural Textures with Hash Functions

Published on: 2025-08-17 02:02:39

Procedural Textures with Hash Functions and Hash Playground I'm the sort of person who gets very excited when simple rules create complex behaviour. The other day, I needed a simple hash function that maps $(x, y)$ coordinates to a colour, and found a straightforward equation that ended up being astoundingly rich. Hence this post; to talk about and play with this function. TL;DR: The boolean predicate $(c_x \, x + c_y \, y + c_{xy} \, x \, y + c_{x^2} \, x^2 + c_{y^2} \, y^2)$ $\mathrm{mod} \, m < \tau \, m$, is richly varied and beautiful. For example, varying $c_{xy}$ with the other parameters fixed: For the rest of this post, we'll try to unpick the function. If you'd prefer to play with it yourself, check out the hash playground. The idea I was trying to make a game that obeyed a 2-bit colour palette. With a strict interpretation of the rules, this means no interpolation or antialiasing — the pixels onscreen should only be one of 4 colours. So I needed textures that could al ... Read full article.