Free SDF raymarcher for Godot 4 metaballs that blend colors, in one shader (CC0 + MIT)

3 months ago by Stratos to c/godot

Signed distance field raymarching in Godot 4, authored with nodes. Physics-driven metaballs melt into the SDF cubes in one fullscreen pass, and since every CSG op works on (color, distance) pairs, the colors blend along with the shapes.

Two free editions: Standalone shader (CC0): one .gdshader, no scripts paste onto a QuadMesh, edit map(). Godot Shaders https://godotshaders.com/...

Node-based project (MIT): shapes as Node3D nodes, live editor preview, physics, up to 32 primitives and a write-up. VavLabs Mit
https://vav-labs.com/...

Distance functions after Inigo Quilez.

youtube: https://youtu.be/Y1sd9Cx4NAs

sp3ctr4l 3 points 3 months ago

To my knowledge, this is the first time anyone has done this in Godot, and that in itself is very impressive.

I was fucking around with my own attempt at giving Godot a kind of octree based ... spatial framework, if that makes any sense... I wonder what that and this could do together.

path: 0 24851937, hotness: undefined, score: 3, children: 1
insomniac_lemon 2 points 3 months ago

To my knowledge, this is the first time anyone has done this in Godot

There is Zylann's godot_sdf_blender. Not sure how it compares, though.

octree based

It would be cool to have Cube 2: Sauerbraten map support (I especially like things like arches and other mesh details). Though a lot of the look can be done with meshes+vertex colors (more materials for things like glow, metal) the missing piece for me is the map editing workflow* particularly something more intended for modularity (Godot's gridmap is clunky when it comes to multiple cell sizes).

* I haven't been able to try the new vertex snapping, nor Trenchbroom/Cyclops

I wonder what that and this could do together.

Excavation game? Both in terms of globbing dirt to walls, and dynamically dividing walls down that convert to SDF objects when small enough for digged surface. Actually this seems to exist as well, JorisAR's GDVoxelTerrain:

This project adds a smooth voxel terrain system to godot. More precisely, it uses an octree to store an SDF, which is then meshed using a custom version of surface nets. Level of detail systems are in place for large viewing distances.

path: 0 24851937 24853719, hotness: undefined, score: 2, children: 0
insomniac_lemon 2 points 3 months ago

up to 32 primitives

This seems very low unless it's nuanced or multiple tricks can be used. Joined operations/volumes/surfaces, scheduled calculations etc. So I'd like to see what can be implemented in more examples.

The SIGGRAPH talk for PixelJunk Shooter 2 covers things like this albeit 2D, distance fields are used for the walls (2, static+dynamic, merged into 1), different shader techniques for liquids.

path: 0 24841388, hotness: undefined, score: 2, children: 1
Vav_Labs 3 points 3 months ago

32 is a deliberate ceiling for this edition, not a limit of the technique. The design goal was set no compute no buffers one file shapes travel as uniform arrays, and every primitive adds a distance eval to every march step on every pixel, so a fully analytic field doesn't want hundreds anyway. The scaling tricks are exactly the ones you list bake everything static into a precomputed SDF texture and sample it as a single primitive. That's the natural direction for the node based edition if it grows to v2

Hadn't seen the liquids part of that SIGGRAPH talk thanks for the pointer, watching it.

path: 0 24841388 24841714, hotness: undefined, score: 3, children: 0
godot
godot

@programming.dev

login for more options
7983
1193
559

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

  • Posts need to be in english
  • Posts with explicit content must be tagged with nsfw
  • We do not condone harassment inside the community as well as trolling or equivalent behaviour
  • Do not post illegal materials or post things encouraging actions such as pirating games

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

  • The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
  • The banner is from Godot Design

go to feed...