#### Archived

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

# Rogk generation algorithm

## Recommended Posts

Does anyone happen to have (or know of) a reasonable algorithm for generating 3D rocks? I want to start with either a spherical or cylindrical mesh as a base, then perturb it through some process until it is a realistic rock shape. Ted Zuvich Home Page

##### Share on other sites
I have not done this but one way would be to displace each vertex a bit in a random direction. To make this look somewhat realistic you probably need very low polygon baseobject.
for each vertex:    v.x += rand( -1.0f, 1.0f ) * factor    etc...

____________________ ____ ___ __ _
Enselic''s Corner

##### Share on other sites
I wouldn''t suggest using the random approach, although it could work, if you used a variation of Perlin noise. That wouldn''t give anything with a proper surface though. One way could be to start with a base object. Now cut pieces off, then smooth if necessary, then maybe cut more pieces off. This would simulate erosion and how rocks are actually formed. By varying the spliting and smoothing, you could create different kinds of rocks.

However this would only create convex high poly rocks. If you''re looking for low poly, then an approach similar to the first suggestion would probably be better.

To slice a rock, you would create a plane, then disregard all vertices on one side, create vertices along split edges and then work out the faces.

Good Luck!

##### Share on other sites
The random displacement idea doesn''t work very well ( I already tried it ). I''ll try the plane-slicing idea; sort of an analogy to the fault-generation algorithm used to generate terrain blocks. Thanks for the replys.

Ted Zuvich

• ### Forum Statistics

• Total Topics
628402
• Total Posts
2982473

• 9
• 10
• 9
• 20
• 24