top of page
School Projects:
Personal Projects
Degree Project
Work Experience
Internship (LIA)

Spline Generator

Software: Unreal Engine 5 

Industrial Technical Artist Degree Project

This PDF is my final exam project report. (Note that the tool have been updated since this PDF was made)

NOTE: I am working on some videos for showing how the spline generator works. They are not done yet

My final exam project was an Unreal Engine 5 tool built with a Utility Widget Blueprint. 
I named the project, and the tool, Spline Generator.

The Spline Generator is a tool that creates a spline (a curve) , with points, based of a pipe like mesh. I created this to make the creation of splines easier because it can be a tedious work to manually create splines that follow meshes like pipes or cables, with the end goal to then easily create spline based VFX (for example to visual the flow in these pipes). 

I simply wanted to get points in the middle of the mesh, and then use those points as the location for placing the spline points. But it sounds much easier than it has been. I have created quite a complex tool, which works for a lot of cases, but there are still improvements that can be done (I will talk more about that at the end)

The blueprint I have created works like this when pressing Create Spline:

1a: It gets the selected Actor in the viewport. 


1b: It gets the values the user have set in the .

​


2: I am clearing potential old variables values and setting them all back to their default value. This is because the program sometimes stored the wrong values when creating multiple splines. 


3: It then determines what kind of mesh it is. I have categorized them into three different meshes: Z Standing Mesh, X Laying Mesh and Y Laying Mesh. And by comparing the mesh local bounds, the blueprint determains which category it fits into. (Z Standing Mesh is a mesh that is the biggest in the Z axis, X Laying Meshes are largest in the X axis, and Y Laying Meshes are the longest in the Y axis.)


4: Then the Min- and Max bound values get set with GetComponentBounds.


5: Then the mesh actual size is calculated so the Distance in the line trace can be set depending on the user set value for how many linetraces the user wish to do.
 

6: Thereafter I am getting all the actors inside the selected mesh Bounds Sphere Radius and saving them in an array Actors to Ignore. This has to be done because when I later on do the Line Trace I have to declare the actors I don't want the line trace to look for an collision on.

SplineWidget.jpg
SplineHideActors.png

7: I do something I call a 360Trace. I usually explain this as a hula-hoop with an amount of points on it, and from each point there is a line (and each line has same lenght as the mesh bounds sphere radius, and its middle point is the Sphere origin but for the hula-hoop). These lines are looking for a collision, if they encounter a collision (on the selected mesh) they will return the location for where they "hit"/"touched" the collision. Those Locations will be saved in an array.

Spline360Trace.png

8: From the hit Locations Array, I get the average value of all those locations.

​

9: Then the "hula-hoop" moves a distance on one of the axis (depending on what type of mesh it is), and it does the 360Trace again.

​

10: When the whole mesh has gone through the "hula-hoop" and there is an array with multiple location average points, it does another 360Trace (which works the same as how I explained under step 7-9). But the difference is that in this Line trace, the location-avrage-points will act as the lines' middle points. I am doing this beacause it will generate more accurate values. 

​

11: I create a new spline asset by duplicating a template spline I have made, and then renaming the new asset to BP_Spline_Child_n where n is the number of the spline created (which depends on how many childs of the template there already is). This asset is then spawned as an actor into the current level:

SplineAssetCreatetion.png

12: With the new Average-points, or as I also call them Middle Points, I set the points of the spline in the newly spawned spline actor.

My tool has been "stress-tested" on cables/pipes inside a car, and it fully worked or at least made the spline 90% correct, on around 70% or the meshes.  Here are some examples when this tool will not work:

PipeThatDoesntWork.jpg
PipeThatDoesntWork2.jpg

How to improve the Spline Generator:

As you might notice, the problem with meshes that doesn't work, have a really weird curvature, or more accurately, when the mesh's curve goes back - the curve is more than 90 degrees.

I am think that the tool/blueprint needs to get a better understanding of how the mesh looks like. Maybe if I create a function that calculates the average diameter, and then I could use that to restrict the area of where the line traces are allowed to look for hit-points.

bottom of page