Draw an ellipse

Hi!

I’m using Unreal 5.3.2.

I need to draw some splines like these ones:

There lines represent the orbits of the planets around the Sun.

Someone has suggested me to use Debug lines, but is there another way to draw it? Maybe with Blueprint Splines.

Any suggestion?

Thanks.

You could also try Niagara ribbons.

Debug lines

That’s PIE only unless you C++ it, Rama’s Victory plugin has it exposed afair.

Thank you. You are great!

I need to draw an ellipse because planet orbits are ellipses. I think I could draw it with your Solar System Simulator/Generator, isn’t it?

Again, thank you.

It does support it yes, as in the anim. Disclaimer: the script is 7-8 years old, there might be embarrassing elements there.

1 Like

Don’t worry. If you want I can show you my code, and that way we can be embarrassed together.

1 Like

I had almost identical problem to tackle. Splines are really slow if you want to spawn them trough code. Niagara may work here.

However i made C++ code that calculates transforms on ellipse (no Kepler calculations, just ellipse with focal points). Transform is done so it always points (rotation) to next point on ellipse, and scale is scaling 1uu to distance between points.

However all that code is in C++ function library, i can provide copy of it, there are multiple functions all blueprintable.

Old screens:

ps (just remembered):
My function draws ellipses in 2d, then i have another function that recalculates array of those transforms into 3d space. I did not work on it for like 9 months (we dropped idea of drawing orbits).

Hello! Did you find a good way to do this?
I tried using a spline with the solar system method that our friend shared, but I wanted the lines to not be affected by distance. For example, when we get closer to the spline, the lines created with the mesh become huge.
I need the lines to maintain the same thickness regardless of distance, just like the debug lines of the spline.
I’m not exactly sure what kind of lines these are, but I managed to get something similar using a wireframe material on the spline mesh. However, now I can’t control the thickness of the wireframe line, so I’m stuck again.

No, sorry.

I know that there is a way to scale material to pixels in actual UMG widgets. Maybe there is way to scale it in 3d space. It should be some 3d vector math:

So stuff to consider:

  • you can make material that uses world coordiantes, and it can draw lines/circles etc that are always 1 meter thick, however that will make those lines thinner further they are.
  • you can get world position of pixel, and world position of camera
  • all you need to do is calculate distance, then rescale that 1 meter thick line to something that is same size on screen

ps.
I asked chatgpt for hlsl code:

float2 ScaledUV(float2 UV, float3 WorldPosition, float3 CameraPosition, float LineThickness)
{
    // Calculate view-space depth (distance from camera)
    float CameraDist = length(WorldPosition - CameraPosition);

    // Adjust UV scale based on distance
    float ScaleFactor = CameraDist * LineThickness;

    // Scale UVs
    return UV * ScaleFactor;
}

it is really simple, and i think this will work just fine. If i have time i may do it as material with nodes.

Thanks a lot for your reply! I really liked your idea and will give it a try.