# How to create an octahedron for sphere subdivision?

I have vertices that generate the first out of two pyramids. However, I want to have the second pyramid facing downwards as to make an octahedron. What are the correct vertices to use, because I've been trying to figure this out for hours

Here is the current pyramid

Here is my desired outcome

And here are the vertices

    // front face
0.0,  1.0,  0.0,
-1.0, -1.0,  1.0,
1.0, -1.0,  1.0,
// right face
0.0,  1.0,  0.0,
1.0, -1.0,  1.0,
1.0, -1.0, -1.0,
// back face
0.0,  1.0,  0.0,
1.0, -1.0, -1.0,
-1.0, -1.0, -1.0,
// left face
0.0,  1.0,  0.0,
-1.0, -1.0, -1.0,
-1.0, -1.0,  1.0,


Close but not quite

The final result due to the answer

I've been trying to figure this out for hours

Next time you're stuck on a problem for hours, spend 5 minutes to check if there's a Wikipedia article about it. (Which, if you're dealing with a platonic solid that's been known since the time of, well, Plato, there is). Here are the vertices you need:

( ±1, 0, 0 )
( 0, ±1, 0 )
( 0, 0, ±1 )

That's just the unit vector along each (positive and negative) coordinate axis, or the 6 facing directions of a cube (an octahedron's dual). You can connect 3 of these on the same side of the origin to make one triangle in each octant:

(Just being mindful of winding - here I'm matching the winding order in your question)

//top-north-east
0.0,  1.0,  0.0,
0.0,  0.0,  1.0,
1.0,  0.0,  0.0,

//top-north-west
0.0,  1.0,  0.0,
-1.0,  0.0,  0.0,
0.0,  0.0,  1.0,

//top-south-west
0.0,  1.0,  0.0,
0.0,  0.0, -1.0,
-1.0,  0.0,  0.0,

//top-south-east
0.0,  1.0,  0.0,
1.0,  0.0,  0.0,
0.0,  0.0, -1.0,

//bottom-north-east
0.0, -1.0,  0.0,
1.0,  0.0,  0.0,
0.0,  0.0,  1.0,

//bottom-north-west
0.0, -1.0,  0.0,
0.0,  0.0,  1.0,
-1.0,  0.0,  0.0,

//bottom-south-west
0.0, -1.0,  0.0,
-1.0,  0.0,  0.0,
0.0,  0.0, -1.0,

//bottom-south-east
0.0, -1.0,  0.0,
0.0,  0.0, -1.0,
1.0,  0.0,  0.0,


This approach ensures the octahedron is centered at the origin (all vertices equidistant, and the origin is their centroid), so that if you take any point on the octahedron and normalize it, you'll get a point on the unit sphere, and your subdivisions will be evenly distributed around the 8 octants. Your original pyramid was not suitable for this use, since its base was at -1, putting the origin closer to the top of the pyramid.

• Ok well thanks for the advice and also thanks because it worked, sorry if I wasted a lot of your time with my confusion. Commented Feb 22, 2023 at 4:39
• No problem, just remember to always ask about your end goal, not about your guess at how to achieve it. As a new learner, your guesses won't be as accurate as experienced users' advice, so give them the context they need to advise you well. Commented Feb 22, 2023 at 4:42
• Ok noted for the future Commented Feb 22, 2023 at 4:44