#### Archived

This topic is now archived and is closed to further replies.

This topic is 5608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have created a metaball / marching cube / cubemapping demo at: http://www-unix.oit.umass.edu/~rwhall/metaball.html Please check it out and tell me what you think.

##### Share on other sites
Nice, but the web page itself is almost unreadable, with blue text on black background

Otherwise, good work!

##### Share on other sites
thankyou kind sir, perhaps i should change my color scheme, but i love black, and the usual black / red has lost its appeal for me...

##### Share on other sites
You should give a user a choice of colors then
Ever tried dhtml?

Note: This is friendly advice, not to be taken as any kind of flame!

kind rgds Nik

PS. sorry for leading the topic in side tracks!
Other readers, don't get stuck on these html issues.

[edited by - Nik02 on August 6, 2003 7:06:05 AM]

##### Share on other sites
i will investigate dhtml...and your reply was phrased in a non-flame like manner.

and also pseudo-bump

##### Share on other sites
hmm... it´s a little slow on my comp (20fps, 1GHz Athlon, GF2Pro) and looks a little blocky.What gridsize (number of gridpoint in every dimension) do you use? How many balls do you have? How do you compute the normals for your vertices (you should calculate vertex normals by using the derivative of your function not face normals, imho)?

I´m running 30fps on a gridsize of 40, 6 balls with 3.9k to 5k triangles and 4.2k to 5k cubes being computed.

I also have some questions about what you wrote on your HP:

>> 1 - The function MarchCube() takes 3 char values (x,y,z) which define the bottom-left-front vertex of the cube to be tested, the edge length of the cube is assumed to be one.

This sounds like you don´t precompute the positions of your gridpoints during initialisation but instead make them whole numbers for easier acces. Is that right? So you also don´t have a definite area where the balls have to be?

>> A stack of structures that contain (x,y,z) coords is used to simulate recursion ( stack overflows can occur if the surface is beyond a certain size, so this way is safer than pure recursion ).

That sounds like a good idea. However I never encoutered any stack overflow. I either have a smaller recursion depth or you have a lot of local variables in your recursion-function.

>> For each metaball, cubes are tested starting at the center and working outwards along all three axes ( just to be safe ) as soon as an intersecting cube is found, the entire surface is recursively rendered.

I don´t think it´s nessecary to check in more than one direction because you definitely will hit the surface in any direction due to it´s a closed surface.

ok, not much said till here, but:

// metaballs stored in an array
// metaball_t mb[NUM_METABALLS]
for( c = 0; c < NUM_METABALLS; c++ ) {
for( int d = 0; d <= mb[c].effective_rad; d++ ) {
MarchCube( mb[c].x + d, mb[c].y, mb[c].z );
MarchCube( mb[c].x, mb[c].y + d, mb[c].z );
MarchCube( mb[c].x, mb[c].y, mb[c].z + d );
}
}

If I get this right you are starting at the positions of each ball then going outwards till you reach the radius the ball would have if it was alone (no other balls influencing the field). Well, assuming that all of your radii are >0 this is totally wrong (unless I´m completely misunderstanding something). The distance of the isosurface (I assume it´s 1) from the center of the ball is always >= radius! So instead you should start at the effective radius (perhaps with a little less to avoid rouding errors) and then go outwards until you hit the surface.

k, one last thing: I was referring to the non-textured version in everthing I said above. For this I´d think it looks much better with single-color and lighting (since you don´t seem to use lighting my question about your normals above might be answered).

##### Share on other sites

you are correct in so far as i do not have some fixed area in which the metaballs can operate. My demo uses 15 metaballs.

I think local vars are responsible for the stack overflows i saw.

I did not think it would be necessary to check in more than one axis, but i encountered some weird errors when i did...The threshold I use for my surface is 0.5, so my method works in this case.

##### Share on other sites
Very nice looking, though I was annoyed at the fact that you obtain the mouse in exclusive mode and then hide the mouse pointer, resulting in an invisible mouse pointer if you run the program in windowed. It makes your program much friendlier to acquire the mouse in FOREGROUND/NONEXCLUSIVE mode.

##### Share on other sites
yes, good call indeed, i just made the demo using the framework i have built up, and as such it uses direct input, even though it is not necessary

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633708
• Total Posts
3013472
×