I’m trying to procedural generate asteroids recently.
It seems there is no detailed implementation I can copycat.
So far I try to implement it by description in those internet discussions.
I think you veterans definitely have different insight, please take a look and give me some comments or advice if you have time/interested, thank you!
Some sample images:
- Generate a subdivided cube or sphere mesh in 1x1x1 bounding box
- Random scale the mesh
- Cut the mesh by random planes. Cut means project the vertices behind the plane onto the plane.
- Displace vertices along normal by noise.
For texturing, there are 2 ways:
- UV mapping (drawback: there will be seams)
i. Cut the mesh to two half, use auto_uv_map to generate UV.
ii. Use Urho3D built-in function GenerateTangents() to generate tangent.
- Triplanar mapping (drawback: the bumpness is not as clear as method 1)
i. Modify LitSolid shader to LitSolidTriplanar by referencing internet articles.
- Generate height map by placing some random craters and white noise.
- Port NormalMap-Online shader to c++ to generate normal map from height map.