So I’m using Splines to create a road system for a city level, thinking that I could easily make it so it scales the texture uniformly on the spline road axis. Turns out I have no idea how to go about it.
Basically is there a way to somehow align the texture to world position on the length of the spline and keep the mesh cords on the width?
If you are using spline mesh then the length between the spline points should be made equal by dividing them by getting location and tangent alone the spline. See this Spline Mesh - Fix mesh scaling? - Unreal Engine Forums
Have you tried landscape splines, if you are not auto populating other props along the road spline then it might be better. https://docs.unrealengine.com/en-US/Engine/Landscape/Editing/Splines/index.html If I not mistaken it also scales uniformly the texture (used long time ago).
I am using spline meshes but I’d really like to do this via material if possible.
If not I’d love it if somebody could give a more detailed explanation on how to make spline points equal without having to change my already placed splines.
I have code in c++.
Points can be made equal without changing any already placed splines.
Ps: let me see if I can post a bp snippet later
Inaccurate way to do it! Don’t do like this!
This is identical to what I already have and it scales the spline based on point distances.
To clarify, if not done by material, is it possible to repeat the spline mesh independently of the points without stretching too much (use the points only as a curve guide) so the UVs of the mesh stay somewhat uniform?
In BP have a variable road size with mesh forward axis size (probably x axis) or calculate it automatically using bounding box vector values. Divide spline distance by dividing it with road size and may be call it road divisions. Loop through creating spline mesh using location and tangents based on road divisions that was calculated. It works with zero stretching.
Please don’t use node spline point for adding new mesh. Instead use nodes get spline length, get direction alone the spline, get distance along the spline. etc.