Working on better ray casting for my bevy destructible terrain plugin.
#bevyengine #indiedev #gamedev #madewithbevy #rust
@donkulosislabs is that for line of sight ? Or useful for explosions/destruction somehow ?
@Vrixyz It doesn't directly pertain to destructible terrain, but I think it'll be a useful feature for games made with this plugin (i.e. player.is_on_ground()), especially if one doesn't want/need to bring in a full physics engine.The underlying quad tree allows a pretty efficient implementation, so I went for it!
@donkulosislabs Thinking from the perspective of a glitch hunter, how hard is it to get the rays to be cast out of bounds?
@julian_beides Good question! In this example, I'm treating white as solid terrain, so zero-length collisions happen immediately when performed out of bounds. But, determination of solidness happens on a per ray basis, so I could see the "solid" condition being flipped based on where the ray originates, to get edge detection no matter where the ray starts. Hope that answers your question!
@donkulosislabs So the detection operates on 2D pixel data and not on a boundary path? That sounds pretty robust
@julian_beides That right. Pixel data is stored in a quad tree, so this ray casting impl is really just walking across tree nodes in a line, looking for whatever criteria you like.
@donkulosislabs Nice! I use signed distance fields in Veridian Expanse. Fast enough, and makes for nice terrain rendering options, but is a bit of a pain to run jump flooding around the area when modifications are made. https://fosstodon.org/@vexpanse/111064246351225209
Veridian Expanse (@[email protected])

Attached: 1 video The effects for the mining laser aren't really done yet, but I love the general feel to it so far. I've had playtesters literally "Oooohhh!" when they first used it. Very satisfying. :) #gamedev #indiedev #gaming #opensource

Fosstodon
@slembcke That looks really awesome! Wishlisted.
The timing of your comment is funny. I actually just started digging into various fill algorithms the other day. Open to any tips or learnings you encountered in making this.
@donkulosislabs Thanks! :) What do you mean by fill algorithms? If you mean jump flooding, I can look for some of my notes in the morning. The @vexpanse account has links to the (incredibly poorly commented) source code, and a playable on itch if you want to fiddle with it.
@slembcke @vexpanse Yep! I meant jump flooding. I'll definitely check that out.

@donkulosislabs @vexpanse I didn't use a lot of references, but I found these useful:
https://bgolus.medium.com/the-quest-for-very-wide-outlines-ba82ed442cd9
https://www.shadertoy.com/view/Mdy3D3

This is my code for doing the jump flooding after editing the terrain, but it's basically uncommented...
https://github.com/slembcke/veridian-expanse/blob/master/src/drift_terrain.c#L590

The Quest for Very Wide Outlines

An Exploration of GPU Silhouette Rendering

Medium
@slembcke @vexpanse Very useful. Appreciate the links!