Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Dan Royer , posted on November 05, 2000




Image Description, by Dan Royer



This is my first attempt at Metaballs. The polygon generation code is _evil_. Fast, but evil. The rendering logic in this version was supposed to be faster, but isn't. That's the last time I take advice instead of just winging it (:

This demo ran at ~30 FPS on an P500 / 256MB RAM / GeForce SDR / Win2K (sp1). I've seen it go as high as 200 FPS.

Features:
  • OGL rendering.
  • Keyboard/mouse controls.
  • User controlled camera movement.
  • Dynamic LOD
  • Wireframe, textured rendering.
  • Special "data visualization" rendering.
  • Surface polygon generation using a version of Marching Cubes. (I implemented this + some hashing and it still ran slower than the naive brute force, no culling, switch-with-256-cases method.)
  • Future plans:
  • Multitexturing w/ alpha channeling for a completely unique surface texture.
  • "SurfCam" which moves as if walking on the surface of the metaball.
  • VSD and collision detection using octtrees.
  • Many-threaded version for multiprocessor machines?
  • Incorporation with my cloth, sky box/sky sphere and particle system demos to make something _really_ nice.


  • [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]

     
    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
     
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
     
    malkia/eastern.analog

    November 05, 2000, 02:31 PM

    You are using Marching cubes, right?

     
    morgan

    November 05, 2000, 02:33 PM

    Sounds incredible, Dan! Can you post a binary?

    -m

     
    L.e.Denninger

    November 05, 2000, 02:43 PM

    dan, the switch-with-256 cases can be reduced to 16 cases, of which only 14 are relevant for rendering.
    (-2 for case of all cube-corners out- or inside, only 16 'cause all others are just the same cases flipped around some axes)

     
    Warren Marshall

    November 05, 2000, 02:52 PM

    "Surface polygon generation using a version of Marching Cubes. "

    :)

     
    Lourens Veen

    November 05, 2000, 03:58 PM

    Perhaps this is of interest:

    About 2 weeks ago Marco Bosma got his PhD with a thesis entitled "Iso-Surface Volume Rendering - Speed and accuracy for medical applications" (ISBN 90-365-1397-5). He uses an novel approach to volume rendering. Depending on scene complexity the framerates are "interactive" meaning several frames per second, Phong shaded. Unfortunately the paper is not available online, more info and some rendered films can be found on this page

     
    Lourens Veen

    November 05, 2000, 04:03 PM

    I forgot to mention that he works for Philips Medical systems, and that his rendering method is patented, so if you're doing this for anything commercial you can't use it directly. But the idea is interesting and if you're doing this as an assignment for a study then it's certainly a good way to get a good mark :-)

     
    Joey

    November 05, 2000, 06:31 PM

    Hi, that looks great. I'm just wondering how long most of you all have been into c++ and opengl/directx programming? i've been doing c++ sort of on and off for about a year (just now really getting into it) and i just started learning opengl. This all seem very complicated to me but i'm not even through all of nehe's tutorials yet so i still have even a lot of the basics to learn. All of this looks very impressive. Also i was wondering if someone could point me to a site with some good tutorials on metaballs and things like that, they look interresting.

     
    Mark Friedenbach

    November 05, 2000, 06:43 PM

    Do at least a year or two of non-graphics related programming before starting on anything big. When you do get into graphics programming, I recommend reading a book or two before you start searching the 'net for knowledge. Most of the info on the internet is either spread out, nonexistant, or assumes that you have a good deal of theory under your belt already (believe me - I spent four months trying to learn this stuff off of the 'net before giving up and buying a book from the local tech store and learning it in three days).

     
    Joey

    November 05, 2000, 06:48 PM

    Thanks, I'll have to get an opengl book soon, i have 3 books for non-graphical c++, one of them i've read about 3 times, the others i still need to finish. So far all i've done in opengl is i made a small program with a textures cube that you can rotate on any axis and just today i started working with adding fog to it. Nothing real difficult but i'm gonna go out and buy a book or two on opengl very soon. I agree, books are really better than the net for learning the basics, if only they offered some programming classes for freshmen at my highschool :( (there is only one programming class which is very basic and is only for seniors).

     
    Bas Kuenen

    November 05, 2000, 07:18 PM

    Looking good Dan! I also did some metaball stuff some time ago. I had much fun with them :)

    What are the 3D grid dimensions, and how many balls are in there?

     
    Nibbler!

    November 05, 2000, 08:08 PM

    That's really cool.
    Is there anywhere that I can go to download an executable??

     
    Mark Friedenbach

    November 05, 2000, 09:07 PM

    It's terrible how high schools simply blow off Computer Science. The high school I went to didn't even offer any comp sci courses. There are plenty of people I know that really wanted to get into programming, but didn't want to go it alone since their school didn't offer courses. Damn shame.

    Anyway, about books.. I'd recommend getting a good book on graphics theory (such as the ones I linked to) before reading any books on a specific API. API books not only ignore most of the details that you should know (just because the API can draw a set of bilinear texture mapped triangles for you doesn't mean you don't need to know how it's done), but they skimp over the theory as well.

    PS: Don't limit youself to one API either. DirectX/OpenGL/Glide is your tool, not your engine.

     
    Joey

    November 05, 2000, 09:16 PM

    Ok, thanks again, i just thought it'd be easier to learn one at a time but now i'm starting to learn that it's easy to mix them sometimes (opengl/glide with directinput, things like that). Since I dont have that great of a knowledge of math yet, I want to get a book that explains as much about the equations involved as possible. Those books you mentioned both look interesting and i will probably be getting them soon.

     
    Bas Kuenen

    November 05, 2000, 09:23 PM

    I'm not Dan, but I learned my metaball stuff from the following sites:

    Great tutorial on marching-cubes:
    http://www.exaflop.org/

    Huge discussion with much links about calculating the normals on these babies:
    http://www.gamedev.net/community/forums/topic.asp?topic_id=14135&forum_id=12&Topic_Title=Metaballs+%2D+Normals&forum_title=Graphics+Programming+and+Theory

    More:
    http://www.phys.uu.nl/~hegeman/marching.htm

    And then some:
    http://old.cs.gsu.edu/materials/HyperGraph/modeling/metaballs/metaballs_mward.html

    Bored already ;)
    http://www.whisqu.se/per/docs/math29.htm


    After reading all of this - you should be a marching-cube expert :)

     
    Dan Royer

    November 06, 2000, 02:59 AM

    Ok, some more info:

    1. An exe will be released when I update my webpage, which will be moving soon (to where, I don't know). Also to be released is my cloth demo. The skybox demo is already available (nothing fancy).

    2. I use a _version_ of marching cubes, not the real thing. Yes, I realize that it reduces to 14 cases, but since I have a single array to store all the field strength info, I just walk the array with three nested for loops and use the counters for those for loops as xyz values. Why? Because the xyz values are stored IMPLICITLY, meaning that each struct for field strength data is is 3 floats smaller and (I hoped) that the smaller steps through ram would mean faster access. HOWEVER, because they are stored implicitely it means that transforming the coordinates is a little more complicated. to be truthful, I haven't put a hell of a lot of thought into how to reduce it to 14 cases, that isn't a priority because rendering isn't the bottleneck.

    3. I get about 6 FPS when I run the grid at a resolution of 64^3, that number triples when I render without recalculating (hence the 16 FPS you see in the bottom right image). Normally when I turn on DLOD it runs at about 31^3, unpaused and 100 FPS, paused.

    4. I have since completed the multitexturing/alphatexturing and the collision detection, without octtrees. I will be adding octtrees anyways for the VSD used when "walking" on the surface of the metaball.

    Kuenen - thanks for the links, my normals were _ok_, but not great.

     
    Vorteks

    November 06, 2000, 10:49 AM

    That looks really, really cool. What are metaballs though?

     
    Mark Friedenbach

    November 06, 2000, 02:35 PM

    There's a good example in the final scene of this demo (you can see a screenshot of it on the righthand side of the page). You'll have to sit through the rest of the intro though (which isn't very impressive). Anyone know if there are any stand alone metaball demos out there?

     
    Jari Komppa

    November 08, 2000, 11:39 AM

    'stash' by the same group, is a sequel to 'jizz', and is much more impressive.. also contains lots of metaballs and stuff. Try www.pouet.net if you have trouble finding it.

     
    This thread contains 18 messages.
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.