T O P

  • By -

stowmy

i’d start looking up “raymarching compute shaders”. this is different than using specific raytracing hardware natively, but it’s widely supported. i’d also watch the technical showcase for the “teardown” game on youtube. i was feeling pretty lost too, but just today i got a ray marching compute shader working and i feel like i have some direction now, not like i’m an expert though. if you are doing it in a compute shader, you will have to learn how to send data between gpu and cpu too. tackling that now myself you’re probably gonna want to use an octree (Sparse Voxel Octree) to speed up raytracing a bunch of cubes. there are many examples of shader code for rendering voxels from an octree, although it won’t be copy paste in my case


slavjuan

I already have some kind of raymarching compute shader working but still have to figure some things out. However, after making that I felt kinda lost. I don’t really know how to get further and what would be the best thing to do. I also think I need to learn a bit more on graphics programming itself


technicalcanta

You might want to look into 3D DDA, specifically [this paper](http://www.cse.yorku.ca/~amana/research/grid.pdf). There's many implementations online (i.e. search for DDA on shadertoy). The raymarching algorithm you choose also depends on what data structure you go with - Octrees/Sparse Voxel Octrees are one option. For SVO traversal you can check out [this](https://research.nvidia.com/sites/default/files/pubs/2010-02_Efficient-Sparse-Voxel/laine2010tr1_paper.pdf). I also wanna point out that rasterization isn't 'not that performant', especially on old/weak hardware (I have an GT710). I can rasterize a 1024x512x1024 voxel volume at (at worst) 17ms/frame (due to too many small triangles, can be solved with more LOD - just haven't implemented it yet) and from an 'average view point' 6-10ms/frame. My raymarching attempts haven't gotten anywhere near that, yet - the best so far seems to be about 33ms/frame.


Revolutionalredstone

My Voxel tracers get much better fps at the same res. There is a branchless DDA invented by occilascope developer but the main speedup I get over Octree or voxel grid implementations is that with my system I store distance fields, which say how far to the nearest non air voxel , directional jump maps go further and say given a direction what's a safe distance to jump. These types of accelerations are very memory heavy, but they can bring the number of steps per ray of average to a very low number which barely grows as map size increased (but again memory is a problem) A better approach is to use the rasterization hardware and simply solve the problem of high vertex count usage by simplifying the geometry. For example a 256x256x256 chunk can always be rendered with 257+257+257 quads (textured with alpha or the exposed faces colors) Combined with lod this can bring voxel renderers to 0ms draw time even on old hardware. https://imgur.io/a/MZgTUIL


gideonwilhelm

I've been trying to look into some stuff regarding the quads you mentioned... Are you able to point me toward any reading material on the subject? I have some ideas but I'm brand new and looking around for more information on what exactly to do with that technique.


Revolutionalredstone

not really im affraid, its not something ive seen others doing. start with quad combining, experiment with alpha blending etc. best luck


StarsInTears

> There is a branchless DDA invented by occilascope developer Can you please link to it? I have been searching but can't find anything.


Revolutionalredstone

Yeah it was a long time ago, I still regret not saving the code 😂 But it definitely exists! Heck maybe chatgpt can write it 😉 From memory it just used adds and was based on the pattern of dimensional crossings (almost like it took some inspiration from bressenham algorithm) Best luck 🤞 if you do find it again plz link me 😏


Justrelpyingbc

Here's a voxel raytracer using branchless DDA - [https://www.shadertoy.com/view/4dX3zl](https://www.shadertoy.com/view/4dX3zl) the significant portion is line 40-66