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/shader/fullscreen-sdf-raymarching-with-smooth-csg-and-depth/

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/case-studies/sdf-raymarcher-godot/

Distance functions after Inigo Quilez.

youtube: https://youtu.be/Y1sd9Cx4NAs

  • insomniac_lemon@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 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.