Splines & Corridors & Blueprints, Oh My!

Hello UE4 Community!

I have started to really get into Blueprints (I usually do just game art) and I am trying to venture into experimenting with things I’ve never tried before.

I am making an environment which has corridors *(hooray!) *[SIZE=2]and I would like to try and build these corridors using the magic of splines.

I’ve created a test mesh and I am following a live stream on Youtube which shows Zak creating a Blueprint for building a race track using splines. I’ve managed to get half way through, taking notes and learning a whole bunch of cool stuff but now its come to the moment where we are starting to include static meshes in our Blueprint.

I am using my test mesh:

[/SIZE]

&stc=1

I’ve given the mesh thickness to stop light leaking and extra loops in preparation for deforming the mesh with the splines.

So far the Blueprint has the very basic functionality, I’ve set it up as an ‘Actor’ blueprint and added my spline component. Following Zak’s tutorial we have made a function that handles the building of the elements/meshes. It also stores local variables for the spline point positions and tangents along with other things I’ll be adding in if I can actually get it working.

Here is the tutorial if anyone is interested: https://www.youtube.com/watch?v=wR0fH6O9jD8

Just to show you what I have so far here is a screenshot of the Construction Script. The nodes are collapsed so I’ll show each part of the Blueprint as best I can without overloading you guys with screenshots.

Construction Script:

&stc=1

Storing Number Of Spline Points:

&stc=1

Building Data Array:

&stc=1

Here is the function which actually handles the building. It is pretty busy so here are a few more screenshots.

Entry Point:

&stc=1

Sequence (Then 0):

&stc=1

&stc=1

Sequence (Then 1):

&stc=1

The meat of the Blueprint is pretty much done and laying out the splines in the editor should result in having my test mesh loft along the spline, but …

Instead I get this.

&stc=1

I’ve tried changing the Blueprint from the Construction Script, messing around with the numbers, changing the Forward Axis in the Add Spline Mesh Component function but nothing seems to have any effect.

I don’t know where in the Blueprint I have gone wrong.

Any help is appreciated, suggestions or even if you see where the problem is using the screenshots, I would be very grateful. I’ve been scratching my head on this one for hours :frowning:

Thanks!

Hello!

take a look at the details of the spline Mesh component that is in your BP. There is an option called “Forward Axis”. You have to change that depending on where the Pivot point of your mesh is located. Just above that option is “Spline Up Dir” which you can try and tweak to see if it changes anything. Its been some time since I last done something with splinemeshes but that should point you in the right direction.

Greetings

Hey @dr4ch.

I’ve started tweaking the values for the Spline Mesh Component function and it seems to be doing something. I am still getting weird stretching on my mesh but at the moment this is now the result.

&stc=1

The end of the mesh seems to be twisted and upside down. I am changing the values but can’t seem to get it just right, I think it is gonna take some messing around with. I have to move the spline points apart pretty far as well to get this result and I had to rotate the spline 180 degrees to get the tunnel the correct way up.

Also the UV’s are crazy stretched on the inside of the mesh.

&stc=1

I don’t know how to combat that, in Zak’s tutorial he can move his spline points anywhere and his UV’s and mesh are all good.

Before I start making different meshes and looking into that side of things. I would like to get the splines working first that way I know I am only left with fixing one problem which would be finding out what steps and I need to take to get a mesh that works with splines :smiley:

Here are the values I have for the Add Spline Mesh Component

&stc=1

Just dropping back in here to mention that I got my spline Blueprint working now. I was wondering if there is a way to stop the texture stretching. I’ve taken a look at the materials made in the SuperGrid pack available on the Marketplace and I was wondering if a method similar to that would remedy the texture stretching on the mesh.

As far as I can gather there is material functions in the SuperGrid pack which are ‘World Space’ (hope I am using the term correctly here haha). This allows me to scale the meshes provided in the SuperGrid pack and the material is always shown correctly on the mesh. I am wondering if a similar method would work for meshes that run along a spline.

Here is my mesh on my spline, the texture stretching is pretty extreme.

&stc=1

Right now I have a Texture Coordinate node in my material to tile the texture even more as the UV shells for the mesh are pretty small.

If you notice the stretching happening, this doesn’t seem as extreme when I use a simple plane along my spline. I’ve exposed a variable in my Blueprint called Mesh Spacing which lets me adjust the space between the meshes that are along the spline.

In my modelling package MODO I’ve set the size of the above mesh in my screenshot to 200 UE4 units for the length and I’ve UV’ed the mesh by selecting the faces and doing planar unwraps (pretty standard).

Here is the UV’s

&stc=1

For now I am not really worrying about lightmap UV’s as I just want to get this texture stretching problem fixed first.

Any suggestions on how to stop or even remedy the stretching would be much appreciated. I don’t know whether it would be best to make my materials world space. I don’t know very much about how to do that or what that truly means.

Just keeping this thread updated as I go along and discover more. World space materials work great with tunnels although there is some problem area’s that you get in the texture where the transition happens from different axis. I was wondering if there is anyway improve the way the transition happens?

I noticed there is a ‘ProjectionTransistionContrast’ available in the ‘World Aligned Texture’ node in the material editor. This only works so well though. I’m not to sure what input it takes it has an (S) next to it. Would this be a ‘ScalarParameter’ node it inputs? I’ve plugged up a ConstantVec1 and that seems to change the way the material transitions.

&stc=1

I am still trying to figure out how the mesh needs to be modelled and when using the spline currently the mesh I am using does the trick but the transition between axis for the material in world space doesn’t look so good.

&stc=1

You could also scale your your texture based on the spline length. To do this you need to setup up a scalar parameter in the material and change the parameter in a material instance in your blueprint. The problem with this approach is if you adjust your spline point handles this will change the vertex spacing therefor stretching or compressing you textures near the spline points.

Hi DANDERSON,

Thanks for the response, I’ve been working on this Blueprint for the past few days trying to figure out the best approach for deformation and materials, I am still learning the Blueprint system and would need to learn how to scale the texture based on the spline length. I am also researching some information on how to model meshes that are going to be used on a spline, I want to be able to change the mesh, like hot swapping by selecting a spline point and picking a mesh to go on that spline point then I can have a variety of different mesh along the spline, I don’t know if this is possible, I am trying to figure out how to do it.

My results so far are ok, the mesh along my spline currently has material ID’s and world space textures and it looks good but I would prefer to use the mesh UV’s for the materials along with its lightmaps to get the best result for lighting.

Extreme angles on the mesh causes the texture to appear to be stretching but I figured out that its the transitions projection on the texture that makes it look messy.

For the hot swapping of meshes using the spline points I don’t know if it is going to work because right now my spacing between the meshes is pretty high and each mesh is tiling to produce the smooth curves in the spline, if I managed to swap a mesh by selecting a spline point and change the mesh at that point then it would tile that mesh rather than only putting one mesh there (hope that makes sense).

&stc=1