Tuesday, November 28, 2023
HomeVisual EffectsI've a beam mesh (a cylinder) that lengths and shortens at occasions...

I’ve a beam mesh (a cylinder) that lengths and shortens at occasions by way of the BP. Is there a option to make the tiling on the cylinder constant so it does not tile an excessive amount of when it is quick and too little when it is lengthy?


Hello, in order the title says, I’ve a cylinder that may change size based mostly on the BP. I’ve a texture on it that proper now tiles an excessive amount of when the size of the cylinder is just too small and too little when the size of it it too massive. Ideally I’m in search of a means, equally to Niagara’s tube ribbon tiling that stays constant whatever the size of the cylinder. I can’t use world house alignment as a result of the beam can transfer in house and it seems off/noisy with WS UVs. Any recommendation or ideas please?


I’ve a setup for this that I did some time again. Give me a number of to seek out it :slight_smile:



2 Likes

You need to use the ObjectScale node to scale the UV will depend on the UV mapping of your cylinder and which axis you scale your cylinder:

So that is how I’ve mine arrange:

  1. The Absolute and Object Place subtract creates an object orientation locked set of values (that’s later divided to created a 0-1 gradient in WS that stays native to the item)
  2. Since I’m solely care concerning the texture staying the identical dimension as I alter my cylinder’s scale on X, I multiply by the ObjectScale in order that it self adjusts
  3. That goes into an Fmod node* together with the parameter enter for scaling my texture on X for the cylinder (alongside it’s size that I’m adjusting, for me)
  4. Which I then divide by that very same parameter that I’m utilizing for texture scale on X. This makes the 0-1 gradient on X/U, and in addition causes the gradient to repeat/tile over each variety of world house models that I’m figuring out with that X tile param.
  5. I’ve the “beginning finish” of my cylinder and its origin/pivot level on 0.0 of the X axis, I’m including half of the ObjectScale X worth after in order that the feel will all the time start at that start line no matter how a lot I’m scaling the item or texture.
  6. After that I masks off the Crimson worth, as a result of I’m utilizing this world house repeating gradient because the X texture coordinate gradient for my UVs
  7. I enter the Y texture tiling param in and multiply it by the inexperienced channel (Y tex coord) of my TexCoord UV enter such as you usually would. It will simply tile my texture on Y such as you would usually count on.
  8. I append the R and G channels collectively, and that’s my remaining UV output that I enter into my texture node’s UVs

This setup offers me the performance of a texture that can all the time begin at my cylinder’s origin, be locked to its orientation so I can rotate it and transfer it round whereas the feel stays in place such as you’d count on with a standard UV setup, and my texture will tile/repeat on X each enter variety of Unreal models no matter how far I’m scaling my cylinder up or down on X. So if I used 500 for my Tile_X param worth, the feel will start to repeat after 500 models. If my cylinder ends are between 0 and 1000 models, the feel will tile twice. If my cylinder ends are between 0 and 250 models, solely half of the feel can be displayed. If you’re dynamically scaling this cylinder up and down, the feel won’t ever transfer or squash/stretch as your mesh shrinks and grows on the native X axis.

Does that make sense?

You are able to do any handbook texture offsets or use a panner node after this setup, and it’ll operate usually. Pan pace ought to keep the identical whatever the cylinder’s scale on X.

*Fmod: Math Expressions | Unreal Engine 4.27 Documentation

Massive shout out to @tharlevfx for the video on Object Area Gradients that was immensely useful when working this out.

I simply wish to reiterate that this setup has the X tiling parameter working just a little otherwise than a typical texture tile setup. With this your X tiling param must be set to the gap of Unreal models you need the feel to start tiling on X. In case you put in 2.0 for Tile_X, the feel will repeat each 2 Unreal models, not twice. If you would like it to stretch and canopy twice the gap, you’ll must double your unique Tile_X worth, not halve it.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments