Voxels

Started by
7 comments, last by Symphonic 22 years, 1 month ago
Is it possible/reasonably fast to make a Direct3D voxel engine? I''m making an engine reminiscent of the old SWIV3D engine, and I''t like to use a voxel map (makes physics much easier to evaluate). What sort of rendering algorithm and data structure might I use? (the map IS wrap-around at the edges) Being somewhat new to this I''m not entirely educated as to the ease with which I will undertake my efforts, but I''m using real-time modifiable terrain (events may make the land rise or fall), if that''s relevant. George D. Filiotis Are you in support of the ban of Dihydrogen Monoxide? You should be!
Geordi
George D. Filiotis
Advertisement
I''ve never done one in directx before, but you don''t need any 3d functions. I may be wrong, but I''m pretty sure that it won''t use any hardware acceleration. However, it is a pretty speedy algorithm and many games before have used it. For the terrain data struct, just use a heightmap (AxA sized 2d array or something). You can deform it easily, and the rendering algorithm would just be a raytracer. With voxels, this raytracing can be optimized to work very efficiently. I think fastcode has a pretty good tutorial on this. For the heightmap, you can pregenerate it with a plasma fractal and maybe preset the borders to be some certain value and tinker with it a little after generation so they wrap around nicely.

Problem is, that I then want to have little dudes running around on the map. If each voxel serves as a vertex with six triangles around it, can I rasterize those triangles with that information? would I have to store two versions of the information? (one vertex buffer and one for the physics engine).

Also, it occurs to me that all of the polygons that make up the map are inherently distance-sorted, so will I be able to make a back-to-front render cycle, and then only bother z-buffering the in game characters?

George D. Filiotis
Are you in support of the ban of Dihydrogen Monoxide? You should be!
Geordi
George D. Filiotis
There''s an article that covers voxel landscape engines including the use of hardware acceleration available at flipcode. You can get it here: http://www.flipcode.com/voxtut/
ok, I made a mistake... I''m talking about heightmaps

Are heightmaps generally efficient? Even though they contribute very large numbers of polygons to the render loop, is the homogeneous nature of the layout going to make the process more efficient?

George D. Filiotis
Are you in support of the ban of Dihydrogen Monoxide? You should be!
Geordi
George D. Filiotis
I just thought of this, is it possible to tell D3D or OGL to generate a z-buffer-map without actually bothering to compare pixels to the contents of the map? (i.e. assume that the pixel being drawn is the closest to the camera, and record the z-information for that pixel.
Geordi
George D. Filiotis
quote:Original post by Symphonic
I just thought of this, is it possible to tell D3D or OGL to generate a z-buffer-map without actually bothering to compare pixels to the contents of the map? (i.e. assume that the pixel being drawn is the closest to the camera, and record the z-information for that pixel.


Yep, just use glDepthFunc(GL_ALWAYS), i.e. always pass the depth test. To read without writing, use glDepthMask(GL_FALSE).
You can use a simple height field with progressive detail. More near, more polygons.
Doesnt give you nearly the same control over polygon sizes in screenspace as raycasting does though, and doesnt have built in occlusion culling either. Because of the slightly moronic way the 3D rendering pipeline is split up at the moment it is the better approach though even without those features, but from an esthetic stand point it sucks (I should mention that the 4DOF method to speed up raycasting a heightmap can be generalized to 6DOF, so raycasting is very very cheap ... but because getting the poly's to the 3D card is not it doesnt matter.)

Edited by - PinkyAndThaBrain on February 19, 2002 12:20:03 PM

This topic is closed to new replies.

Advertisement