PDA

View Full Version : Drawing a lot of cube (voxel?)



greg2
10-01-2003, 09:52 AM
I need to display a 3D shape created by a lot of particules generated in real time.

I can use cube with 6 faces for the particule, but maybe it's not the fastest way to do that?

I think of using a lot of vertices instead of cube. But the problem is that all the vertices will have the same size (the vertices in front of the camera and far from the camera will have the same size).

I have seen some demo or game which use Voxel to render a scene (such as Outcast or Commanche).
Could Voxels be faster?
Is it easy to use?
Where can i found some good documentations about Voxels?

Thanks.

10-01-2003, 10:04 AM
I'm not really sure what you want, this is probably a question for the advanced forum...

[url=http://www.google.com/search?q=Voxels+OpenGL&ie=UTF-8&oe=UTF-8]http://www.google.com/search?q=Voxels+OpenGL&ie=UTF-8&oe=UTF-8[/url

greg2
10-01-2003, 11:50 AM
In fact, i want to be able to put pixel on the sceen in a 3D space.

In a 2D sceen, we can draw a pixel in a "2D matrix" with a square.

In a 3D scene, i want to draw a pixel in a "3D matrix" with a cube.

I can't use glVertice with glBegin(GL_POINTS) because i want my cubes to be bigger when there are near the camera and smaller, when there are far (like in a perspective 3D scene).

torisutan
10-01-2003, 06:56 PM
What you want is a method called "volume rendering".

http://www.google.com/search?q=%22volume+rendering%22&sourceid=opera&num=0&ie=utf-8&oe=utf-8

the basic idea is to take a stack of 2d images, and render them as a cube. altho this can also be done with a 3d texture.

take the time to read some papers on the topic (there are a lot out there). it's not something that can be explained in a simple forum post (well, i don't think so anyways).

--tristan

10-01-2003, 07:04 PM
Very interesting.

madmortigan
10-02-2003, 04:52 AM
I agree this is more like a forum itself (volume rendering) rather than just a message in a forum. Lots of background there, but...

Isn't it tempting to start trying out stuff on your own?!

So you have your voxelized 3d object and you want to render it. Question: Do you want to display just the surface of this object or the interior as well? (With voxels, usually you have some sort of property/number/value associated with each one, say, temprature, and you may want to display that info as well, possibly by coloring the cubes as you refer to them in different colors, depending on their temp.) If yes, bad news, this is an open problem in scientific visualization, there are solutions, but it's the 'welcome-to-the-real-world-buddy' type of problem!

IF not, ie, you only want to just render the object as solid, okeydokey:
I'd say, the problem varies from trivial to big time tough, depending on the connectivity information you have for your voxels. You'd like to know at least whether or not a voxel is interior (which means, it can't be seen from the outside, ie, never render this). You'd also like to know which are the neibours for each voxel. Based on that you can connect the surface voxels (their center points) forming triangles, which then you may render. There is then the extra complication not drawing the back facing triangles, but that trivial compared to the original problem.

So, summarizing, it depends no what you want to display and what coonectivity info you've got along with the voxels.

madmortigan
http://www.opengl.org/discussion_boards/ubb/smile.gif

greg2
10-02-2003, 07:05 AM
I want to display the construction of DLA Fractals in 3D (in Real Time).

In 2D, i can display a lot of pixels (consituating the fractal) in a 2D grid.

But in 3D, the 2D grid becomes a 3D grid.
This is why i need to display cubes instead of pixels, because I want to see the depth of a particle (if I display only pixels, I won't see the depth information).

The fractal becomes biger and bigger, and i need to draw all the cubes very fast.

I don't know exactely what is a voxel and how to render it.

But i know that displaying a lot of cubes (with 6 polygons) will be very slow after serveral seconds.

My question is:
What is the best way to render my fractals?

I have seen voxel engine, and i have tought it could be a solution.
But i don't know how it works, and even if it's faster than rendering polygonal cubes.

greg2
10-02-2003, 07:08 AM
i want also to rotate the view around the fractal

madmortigan
10-02-2003, 02:54 PM
You want to display a 3d fractal. From my limited knowledge of these mathematical creatures, each point in 3d space is considered to be inside the fractal set, if the specific fractal law you apply with this point as a seed converges - or something like this. Moreover, the color of this point is determined by how fast this covergence occurs.

This is not straightforward to visualize. Imagine you have the mandelbrot set (2d) and you want to visualize on a line. Same problem.

By the way, a voxel (volume element), is the 3d equivalent of a pixel (picture element).

One solution is to use some sort of transparency in your cubes. This is eye candy (or can be), but makes rendering even more complicated. The principle behind this is similar to the way doctors use ultrasounds to see babies before they are born.

May be you'd like to start from the simplified version of the fractal, where a point is either in the fractal set or not, without color info. Then you have 3d regions that belong to the fractal (given a scale), and region that don't. Being in 3d space, you sort out your voxel connectivity problems I mentioned above in a relative inexpensive way. So, for the shake of rendering, you could get the typical polygonized model to display.

If you implement this, but you still want to see what's inside and not only on the surface of these region, a cheap trick (which funnaly enough always works for the pro's) is to display cross-sections, ie. 2d slices of these fractal regions. These should be fractals as well. You could control the position and orientation of the slice from your 3d model.

Can this be done real time? My guess is that you have to try very hard in order to get something decent displayed real time.

May it's time to start reading all that volume rendering background material after all!

Sorry I can't be of any more help.

Have fun

madmortigan
http://www.opengl.org/discussion_boards/ubb/smile.gif