5 ms·
> Do you basically draw two triangles that fill the whole screen and then render everything using a shader? Yes. It determines the ray origin and direction for
by gavanwoolery 11y ago
> Do you basically draw two triangles that fill the whole screen and then render everything using a shader?
Yes. It determines the ray origin and direction for each pixel, and casts out a ray from there with pretty standard ray tracing methods and a few additional tricks I mention above.
> And how do you store that many voxels? A sparse data structure? When you have a large solid area do you simply say this entire area is filled so don't have to represent the voxels individually?
No voxels anymore, although it can be fairly easily "voxelized" by clamping the step space of the rays to approximate towards the nearest cube. So, I guess I might have to change the name, or make it look more voxel-ly :)
> I saw a video where you cut away sections of a building using a brush. Do you store the building voxels and then store the subtraction separately? If you had a world with thousands of buildings in it and cut away a little at each does that mean you can no longer share the shape of each building and space requirements blow up?
You can store a million modifications in a few megabytes. I was never intending for it to allow that many though, but I will figure out what corner cases are worth addressing.
- tgb 11y agoAre you doing ray tracing or ray marching? You seem to mention both. Very neat stuff! I've been playing around with ray marching and it's awesome what can be done. I love finding mature projects to inspire me.
- gavanwoolery 11y agoPrimarily ray marching. I tend to switch / misuse the terms. I do perform a few calculations without marching though (ray intersection with some types of geometry).
- rsp1984 11y ago> No voxels anymore So how do you represent geometry then? Mesh? SDF? Space tetrahedralization?
- gavanwoolery 11y agoSame way I've always done in VQ - with math/logic :)
- chrisseaton 11y agoI don't get it - do you write a mathematical function that says whether or not you have intersected with anything in the world? How does that not turn into a huge piecewise? How does that allow you to change the geometry, as I guess it gets compiled into the shader?
- gavanwoolery 11y agoYou can get somewhat of an idea how it works here: http://www.voxelquest.com/news/how-does-it-work http://www.voxelquest.com/news/how-does-it-work You can change geometry by passing parameters to to the shader or creating special object generation functions within the shader. This is not intended to render everything in the game, mostly just aspects of the environment that can be easily procedurally generated like terrain and structures. Other things can be merged in from a traditional pipeline like using polygonal character models (or even sprites, as I have shown in my past demos). The more that you can define mathematically, the better. Doing texture lookups is almost an order of magnitude more expensive sometimes, and less precise always. You start really simple, and say did I hit the bounding box that contains the object? If so, did I hit the more complex piece of geometry within that? If so, what UVW coordinate did I hit on the geometry? Marching through the UVW coordinates on the ray, you can create any sort of procedural texture. I have shown a voronoi texture and a shingle texture but really anything can be created and some procedural textures are very cheap compares to others (voronoi is relatively expensive). If you look at old shots of my terrain, it is all created with voronoi and noise pretty much. http://www.voxelquest.com/gallery.html http://www.voxelquest.com/gallery.html It is possible things will get too expensive to do in realtime, but the option will always be there. Worst case scenario is that I can render like I did with my old isometric engine and cache the render results. At the very least the option will always be there for more powerful computers in the future. That said I think realtime is feasible on decent midrange/modern hardware.
- Guvante 11y ago> You can store a million modifications in a few megabytes. How are you localizing the modifications? I have read of techniques for allow modifications for work like you did previously, by tweaking a small set of inputs based on the modifications you need. However I don't know how you would do that in a ray marching scheme. I guess you could do a more traditional render of simple objects into a buffer to generate a mapping of what each pixel needs access to combined with storing your changes in a texture. However that would kill your cache as locality would be painful to maintain...
- gavanwoolery 11y agoModifications can be localized in each cell or voxelized. The old method I used just voxelized the modifications. In ray marching with SDF union and subtraction are easy. You can load localized modifications for a cell with one set of texture reads. Will prob be roughly approximated and limited.