Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Random shapes;

  1. #1
    Intern Contributor
    Join Date
    May 2000
    Location
    St. John's, NF, Canada
    Posts
    50

    Random shapes;

    I need some help creating random sphere (dont have to be perfect spheres) like shapes out of triangles. Any suggestions on how i should go about this?

    Thanks
    Chris

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,505

    Re: Random shapes;

    If I understand correctly, you might want to look into implicit surfaces and the marching cube algorithim.

  3. #3
    Intern Newbie
    Join Date
    Jul 2000
    Location
    Paris, France
    Posts
    43

    Re: Random shapes;

    the marching cube algo http://www.swin.edu.au/astronomy/pbo...ng/polygonise/
    but they are more simple algo to do irregular spheres (draw simply a sphere using cos and sin, and add a small random value to the radius)
    -G-

  4. #4
    Intern Contributor
    Join Date
    May 2000
    Location
    St. John's, NF, Canada
    Posts
    50

    Re: Random shapes;

    Thanks for the info, I was hoping for something a bit simplier. (The random radius is what im doing now but im looking for slightly less round objects.) I basically want to make some random rock looking objects (very rare in real life to find perfectly spherical rocks).

    I read through the marching cube paper and it seemed a little over my head, but i guess it is something new to learn.

    Chris

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,505

    Re: Random shapes;

    For something that looks rocky, look into fractals. There is a nice fractal algorithim for producing mountains and terrain, I can't remember the name of it off hand. But what you could do is start with a coarse sphere, say one with 12 sides or so, then subdivde each edge and offset the new points by a small random amount. Use these points and the old to form a new set of edges. Then repeat for as much detail as you need. To get repeatable results, be sure you seed your random number generator with a constant value. In fact if you have a need for more than one rock I would at initialization time, seed the random number generator with a constant, and then use it to get a random seed for each rock. Then when rendering a rock seed the random number generator with its own seed. Then after all rocks have been rendered, reseed the random number generator with the timer value or a random seed created before the first rock was rendered.

    [This message has been edited by DFrey (edited 07-26-2000).]

  6. #6
    Intern Contributor
    Join Date
    May 2000
    Location
    St. John's, NF, Canada
    Posts
    50

    Re: Random shapes;

    Thanks for that suggestion, it looks (in my head) like what I want and it also seems really neat to implement.

    Thanks
    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •