Sign in

Jeff Smith

@jeffsmith.bsky.social
271 followers 977 following 114 posts

Game designer and developer @ Incoming Games. Shadow of Aya coming soon. www.shadowofaya.com

PostsRepliesMedia
Jeff Smith @jeffsmith.bsky.social · 01/05/2026
😑
Screenshot of code that says “if ‘image’ equals zero, make ‘image’ zero”
010
Jeff Smith @jeffsmith.bsky.social · 20/03/2026
000
Jeff Smith @jeffsmith.bsky.social · 20/11/2025
But doctor,
A restaurant named “Pagliacci’s pizzeria”
000
Jeff Smith @jeffsmith.bsky.social · 20/11/2025
But doctor,
A restaurant named “Pagliacci’s pizzeria”
000
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
As a final flourish, I add a simple particle system to simulate ash. And with that, the effect is done—until it’s not. Iteration continues, and the needs of tomorrow may outweigh the needs of today. But that is another problem! One at a time.
0151
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
In the way these things sometimes happen, this works perfectly the first try.
120
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Until it works! In the end I add a vertical blur to let the distortion “rise” off the lava. I also tweak the noise for less intensity, and add a cosine wave to the original sine wave, using a different amplitude and frequency. I’m happy with the distortion pattern now, but something’s still missing.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
So much of this kind of work is iteration. You have an idea, you test the idea, you modify the idea, you test again. This thing I thought would work is too subtle, what if I multiply it? My code is broken, what error did I get? One problem at a time, over and over, and over again
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
We’ll try a blur so that the mask softens and expands. This looks much nicer in this view, but will certainly need adjustment for the final effect. I can already guess that it'll need the gamma boosted, or a directional blur of some kind
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Let’s switch views to see the mask channel itself. We can see our perlin noise texture, and how it has the harsh edge of the lava tiles.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Returning to our heat filter—and—it works! Well, it masks to the right layer. We still have to figure out this distortion effect. And the next thing I want to try is expanding the mask—looking at it now, it's become too subtle, only visible around the lava edges, in a way that’s easy to miss.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
This was a long detour, but we learned something, and that’s worth it in my book. (It also helped me solve a bug in an unrelated part of the code—a topic for another time.) Our updated originalDepth calculation now looks like this:
Updated shader code with a new depth conversion formula: depth * (zfar - znear) + znear + zfrom
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Something about the number 10 is tickling my brain. I seem to recall a 10 somewhere related to camera setup, so let’s take a look in the camera code. Say, what’s this random -10 value?
A snipped of GML code. A call to "matrix_build_lookat" is passing -10 as one of the parameters.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Hang on. The Lava layer should be at 5282, but in the shader output it’s 5292. And the layer that *is* visibly distorting, Rocks_2, is at 5272, not 5282 like the shader says. So every layer is off by 10 for some reason...?
A log showing several layers being moved to specific depths. Rocks_2 is moved to depth 5272. Lava is moved to depth 5282.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Let’s see what’s going on. My guesses are either a math error on my part (likely, and maybe an easy fix) or insufficient precision in the depth buffer (unlikely, and maybe impossible). Using my new tool, I can get the depth as interpreted by the shader at each pixel, and, uhh, huh. It looks… right?
A debug view of the same "fire zone" scene. Objects are highlighted in red or green, and tile layers are shown in shades of teal. The mouse hovers over some lava tiles, showing the number "5292"The same debug view again. The mouse hovers over the distorted rock tiles, showing the number "5282"
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
And so. On the shader we pack our value into the rgba channels of the output pixel. We then read the target surface as a buffer, and reverse the math to get back what we put in. Hardly efficient, but fine for a debugging tool—and lets us peek at exactly what values our shader is working with!
Another shader excerpt. This one writes the "originalDepth" float into the rgba channels of the output.A GML function that reads pixel data from a surface buffer, and reconstitutes it as an integer. The numbers used for multiplication match the numbers used for division in the shader.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
That did not do the thing! At first glance I thought it did nothing at all, probably I screwed something up and broke the shader. But looking closer, it *is* distorting, and it is masking—just not on the right layer. So something is up with how we’re reading or writing the depth value, maybe
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
This *should* enable us to mask on the lava layer by simply checking that `originalDepth == lavaLayerDepth`. And because of the way the depth buffer overwrites ‘further’ values with ‘nearer’, we get occlusion for free. In theory! So let’s spin that up… and… hm.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
By passing the buffer into a shader, it’s possible to read the original depth value like so (This formula works because we have an orthographic projection with a fixed-z-position camera; for other scenarios it would be more complex)
A screenshot of code from a shader. The depth conversion formula is "depthSample.r * (zfar - znear) + znear"
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
Take two: I decided to try masking the distortion with a scrolling perlin noise texture. This definitely cuts down on the intensity, but I’m still feeling queasy looking at it. At this point I’m now certain that the final effect cannot cover the whole screen.
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
My first attempt: a simple sine wave applied to the whole screen. Partly this was to be sure I’d set up the shader correctly, partly this was to see if sine distortion could work as a starting point. Verdict: uhhhhh I’ll get back to you, I immediately have a headache
100
Jeff Smith @jeffsmith.bsky.social · 17/10/2025
This has turned out all right! So I thought I’d do a little thread on it. For reference, this is what I started with—a typical fire-y area with no vfx applied. I quite like the lava animation my brother made, but I’m aiming to add just a little extra “this place is hot, like so hot you guys”
100