All Posts

What is the type of a function that loops forever, or crashes the program? How do you represent a function that can’t normally be called, or parameterize a type so that some versions of it can’t be created?

One solution is the bottom type, which is one of the simplest and weirdest concepts in programming. It’s closely related to “bottom”, something that is part of nearly every program but rarely shows up explicitly except through bottom types.

While bottom types show up in plenty of programming languages, Haskell in particular has two very different ways of representing bottom. I’ll start by talking about bottom separate from any language, and then move into what Haskell does. I can’t promise that this will be useful every day, but it’s a mind-expanding sort of idea that might help you see new solutions to old problems.

Read more…

Writing compute shaders in Godot is currently a bit intimidating, requiring relatively low-level work for simple operations. The documentation for RenderingDevice, the primary way you setup and run compute shaders, straight up tells you to read the Vulkan guide if you’re confused. I’m writing this tutorial series as evidence that, for simpler use cases, this is usually not necessary. Compute shaders can be tremendously powerful and flexible, and you shouldn’t be intimidated by them.

This post covers reading from and writing to textures. I’ve often found myself manipulating textures via compute shaders and using them on-screen in vertex or fragment shaders. It’s also how you write compositor effects.

This tutorial started by copying the Heightmap Demo, but has simpler examples, more explanations, and some broader context on why it’s structured as it is.

Read more…