PDA

View Full Version : Random shapes;

Whittick
07-25-2000, 08:27 AM
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

DFrey
07-25-2000, 09:35 AM
If I understand correctly, you might want to look into implicit surfaces and the marching cube algorithim.

nikopol0
07-25-2000, 11:38 PM
the marching cube algo http://www.swin.edu.au/astronomy/pbourke/modelling/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)

Whittick
07-26-2000, 07:08 AM
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

DFrey
07-26-2000, 07:30 AM
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).]

Whittick
07-26-2000, 07:45 AM
Thanks for that suggestion, it looks (in my head) like what I want and it also seems really neat to implement.

Thanks
Chris