Friday, June 11, 2021

Meshing the surface points of some spherical volume... 8-)

I should revisit my blocky asteroids, made with 3D Worley Noise. I can mesh the surface points by building out edges and triangles but I could just draw cubes for the surface; butt fugly, but workable, especially for a dead stupid simple version of an asteroid mining game where the habitat volume is minecraft-type cubes, bleh! 8-P Alright, meshing the points of the surface… 

First we make a 3D grid of points and worry about the sphere inside this cube. The surface points are the ‘inside’ points which have ‘outside’ neighbors, which will be at or near the surface of my sphere, and can be shifted to the surface to make a better spherical polyhedron. They link up with their nearest ‘surface’ neighbors to make edges and adjacent edges make two sides of a triangle with the far endpoints of the two adjacent edges making the third edge of a triangle. We’re looking for the closest points surface points to a given surface point, points which are in the cube of 26 points one grid point away, plus or minus XYZ, so points less than 3^½ away, so a point at (-2,0,0) doesn’t count (-2^2=4), and I don’t even need to take the square root, which my computer will appreciate…

I make a list of these points and make edges. There should not be more than eight of these adjacent edges, you turn them into triangles. The third edge of each of these triangles will be an adjacent triangle. We need to find a surface point which is close to the other two corner surface points. This is all a matter of going through the surface point cloud, which means I should be able to do a cloud of random surface points after I make this work. Hah! 8-P

Later- I should get to this, but of course I just want to make procedural cube-spheres for some reason (each face is a grid one cell wide and high which I’m pretty sure I can subdivide by the worlds’ diameter or circumference, divided by a thousand kilometers, we don’t have all day or a big enough canvas)… well, I have an algorithm for deriving points at right angles, which I could use to make a procedural octahedron first, that’s actually more my style, as if I didn’t want to code a tetrahedron, which I also could and probably should, then subdivide each of four faces six ways and push them out to finally get a poor Vinnies’ icosahedron (with 24 faces…)! I can evenly fairly quickly revise the serpentine landmass code I’m already working on, which I ought to stay the course on...


No comments:

Post a Comment