Voxels?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Voxels?

Post by Graf Zahl »

They are not converted into MD2 but I need to convert them into something OpenGL can render.
User avatar
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA

Re: Voxels?

Post by Demolisher »

Gez wrote:Voxels are converted into MD2 models in GZDoom. This conversion can take a while, that's why when you load the voxel test room in GZDoom, you've got long seconds during which GZDoom is seemingly frozen.
Similar to shaders? Try to apply one to every texture in a map, and that map will take ages to load.
User avatar
Chris
Posts: 2954
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Voxels?

Post by Chris »

Shouldn't it be possible to load the voxel data into a 3D texture, render it as a 9-sided cube, and use a pixel shader to essentially do a ray-cast on each pixel of the rendered cube faces? If you have the normal, binormal, and tangent of the cube, along with the eye/camera position, you can find the direction of the "ray" (the vector the camera sees a particular pixel at). Then you step along the ray until you find an opaque texel in the 3D texture, and render that with the appropriate depth, or until you reach outside of the 3D texture and 'kill' the pixel. That's basically how parallax mapping works, except it uses a 2D texture heightmap instead of a full 3D texture. This will even give you proper translucency as you're rendering only the texels the camera can directly see.

That way, you're essentially just rendering 3 'parallax-mapped' faces (the rest will be facing away from the camera and can be culled before fragment processing) which should be doable on anything GF6 and above. Without shaders, you can build a model using the Marching Cubes algorithm, or whatever.

Just an idea, anyway.
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Voxels?

Post by Nash »

In a similar fashion, can the code behind poly2vox be integrated into ZDoom so that MODELDEF models would be converted on the fly so that MD2 and MD3 models can be rendered in the software renderer?

Not sure how it would handle animations though. Maybe skip interpolation and just convert whatever keyframes that already exist in the model file...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Voxels?

Post by Graf Zahl »

Chris wrote:Shouldn't it be possible to load the voxel data into a 3D texture, render it as a 9-sided cube, and use a pixel shader to essentially do a ray-cast on each pixel of the rendered cube faces?

Too memory intensive. Don't forget that you need width*depth*height*4 bytes for each voxel so even for something small like 32*32*32 you already have 32 kb of texture data and for larger stuff the amount increases dramatically and soon exceeds your available memory
If you have the normal, binormal, and tangent of the cube, along with the eye/camera position, you can find the direction of the "ray" (the vector the camera sees a particular pixel at). Then you step along the ray until you find an opaque texel in the 3D texture, and render that with the appropriate depth, or until you reach outside of the 3D texture and 'kill' the pixel. That's basically how parallax mapping works, except it uses a 2D texture heightmap instead of a full 3D texture. This will even give you proper translucency as you're rendering only the texels the camera can directly see.
Too calculation intensive.


What I do is to convert the voxel into a polygon mesh and put that into a vertex buffer. The overhead does not come from rendering but from setting this up. The engine was never optimized for heavy vertex buffer use so the amount of GL state changes to set up a voxel are a bit high.
User avatar
DooMAD
Posts: 44
Joined: Fri Dec 30, 2005 5:13 pm
Location: UK

Re: Voxels?

Post by DooMAD »

Been having a bit of a history lesson thanks to this thread and it turns out that John Carmack was actually looking at the possibility of using voxels in Doom and even made a voxel editor. I doubt the editor will be much use to us, as it outputs to a different format and has a somewhat unusual interface which, while intuitive, is very restrictive. Fun to mess around with though.
User avatar
SyntherAugustus
Posts: 973
Joined: Tue Jul 15, 2003 5:43 pm

Re: Voxels?

Post by SyntherAugustus »

So I tried loading voxtures.wad into gzdoom and it hung trying to load. Any way of doing the voxel to md2 conversion before gzdoom loads?
User avatar
phi108
Posts: 976
Joined: Sat Dec 01, 2007 6:28 pm

Re: Voxels?

Post by phi108 »

Heh, I tried that and it froze both GL and software GZDoom, strangely. A wolfenstein room with a few voxel barrels slows down GZDoom on my computer, so I don't expect it to work, unless a conversion could lower the number of polys by making "flat" voxel surfaces one polygon, maybe also detecting a regular stairstep pattern and making that a single poly too. Even then, it would probably be too many models for my computer. Here's hoping Lucious has usable success with whatever rendering he's cooking up in DarkXL.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space

Re: Voxels?

Post by NeuralStunner »

phi108 wrote:I don't expect it to work, unless a conversion could lower the number of polys by making "flat" voxel surfaces one polygon, maybe also detecting a regular stairstep pattern and making that a single poly too.
Flat yes, stairstep no. Sounds too much like filtering that way. :P
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Voxels?

Post by Gez »

blackfish wrote:So I tried loading voxtures.wad into gzdoom and it hung trying to load. Any way of doing the voxel to md2 conversion before gzdoom loads?
Have you tried waiting for a while? The conversion to model can take a long time during which it seems it's frozen.
User avatar
SyntherAugustus
Posts: 973
Joined: Tue Jul 15, 2003 5:43 pm

Re: Voxels?

Post by SyntherAugustus »

I waited 5-10 minutes and no load. I've been loading other levels with voxel_test.wad attached and the max loading time is like a minute.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Voxels?

Post by Graf Zahl »

blackfish wrote:the voxel to md2 conversion before gzdoom loads?

Since such a conversion never takes place it can't be done before the voxel loads.
User avatar
DooMAD
Posts: 44
Joined: Fri Dec 30, 2005 5:13 pm
Location: UK

Re: Voxels?

Post by DooMAD »

4mer has finished both the Short and the Tall Gas Lamps. Updated zdoom_vox.zip yet again.
User avatar
SyntherAugustus
Posts: 973
Joined: Tue Jul 15, 2003 5:43 pm

Re: Voxels?

Post by SyntherAugustus »

Love the new voxels. Have you noticed though that the rocket launcher fires backwards?
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Voxels?

Post by Gez »

Return to “General”