How to place n equidistant points on a sphere?

There is a sphere. At it’s centre are long objects—let’s call them rays—anchored from one end. They all need to be radiating out at equidistant points through the surface of the sphere.

The model needs to be designed in a manner that can automatically recalculate positions based on the number of rays because the count will slowly increase over time and sometimes decrease.

I understand that purely equidistant placement is impossible to achieve in some cases, e.g. 5 points, but an approximation would be sufficient.

The paper A New Computationally Efficient Method for Spacing n Points on a Sphere by Jonathan Kogan may be of use—it even includes some python code at the end—but I do not know how to implement this in my use case.

Do you know how this can be achieved? Any guidance would be greatly appreciated.

It’s called a Fibonacci lattice ( or one method of doing this ).

If you take a look at the module in Niagara called, SphereLocation ( double click it to see the code ), there is an option called ‘Uniform’ for the distribution.

This uses a lattice.

Basically, what you do is use polar coordinates to distribute items on your sphere. You can convert the polar coords to cartesian ( ie vectors ), using a formula

image

I will put my blueprint code up tomorrow, but not at the machine right now.

Wow! Thank you so much for this lead. I just played around a bit and it is exactly what I was hoping to find!

So, the next step is having objects anchor at the centre of the sphere and radiate out at the points as determined by Niagara>Particle Spawn>Sphere Location. I wonder if that can be achieved with ribbons, since I essentially do want to have ribbon-like formations coming out of the sphere.

Do you think I should open this up as a new question? Your answer really is the solution to the main topic question. If you agree, I’ll edit this post and post a new Q.

Feel free to mark it as answered :wink:

I didn’t realize you actually wanted to use Niagara, I was only pointing at that module as an example.

If you want to use Niagara, then you can specify the ribbon start and end points using sphere location.

Here’s the reverse engineered code:



and the function is

3 Likes

If your working in c++ you can use

TSphericalFibonacci SphericalFibonacci(NumPoints);
// access index
const FVector3 RealType=SphericalFibonacci.Point(PointIndex);
// convert to normal vector for ue4
FVector SphericalCoord(RealType.X,RealType.Y,RealType.Z);