I kinda gave up with it when I posted it here. Mapping an icosphere is an art. Some people have come up with decent results, but unless you specifically want one, it’s far easier using a sphere.
I don’t think you’d need any fancy math in this case since it’s basically a sphere. Adding up the three vertex vectors and normalizing the result should give the triangle center normal no?
The perils of not being educated in the field you love… big gaps in the horizon of things you should really know at this point my strong point is not maths, though i try to eradicate that with reading as time goes by. i have a soft spot for it these days.
Thank you for posting this algorithm.
An icosphere might make a nice replacement for com.jme3.scene.debug.WireSphere
I’ll probably add it to one of my libraries at some point.
For any sphere, if the mesh is radius 1 then the vertex positions are also the vertex normals.
…it’s only if you want a flat sided sphere that you need to average anything. But then you would also need to unshare the vertexes (I assume they are shared in this mesh).
What does your texture look like using Longitude/Latitude mapping? Is there any stretching/warping around the axis poles?
I used hardcoded uv coords on the principle icosahedron mesh to match a “Fisher/Snyder’s equal-area polyhedral projection” texture template, but i have a lot of unused space as i made to fit into a texture with 2:1 resolution ratio (512x256) which extends slightly past the edge of the uv map to avoid stretching the unwrapped triangles.
it is fairly easy to accommodate new vertices from subdivision as it is basically the 2d variant of the method for getting the midpoint for each edge of the principle triangle during subdivision.
That’s the problem with this shape, there is no way to project a texture economically on to it. I use it as a glowing orb to represent a spirit, so just use vertex colours instead.
It irks me that I didn’t put any reference links in the code to what I read on getting this working. But as far as I recall, you get two choices, economical texture use with warped poles or wasted texture space with 1:1 mapping.