Saturday, December 9, 2023
HomeVisual EffectsI've a beam mesh (a cylinder) that lengths and shortens at instances...

I’ve a beam mesh (a cylinder) that lengths and shortens at instances through the BP. Is there a solution to make the tiling on the cylinder constant so it would 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 primarily based 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 giant. Ideally I’m searching for a approach, 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 appears to be like off/noisy with WS UVs. Any recommendation or suggestions please?


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



2 Likes

You need to use the ObjectScale node to scale the UV relies 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 thing)
  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 likewise causes the gradient to repeat/tile over each variety of world house items 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 place to begin no matter how a lot I’m scaling the thing 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 closing UV output that I enter into my texture node’s UVs

This setup provides 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 traditional UV setup, and my texture will tile/repeat on X each enter variety of Unreal items 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 items. If my cylinder ends are between 0 and 1000 items, the feel will tile twice. If my cylinder ends are between 0 and 250 items, solely half of the feel can be displayed. In case you are 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 perform usually. Pan velocity 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 House Gradients that was immensely useful when working this out.

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

That is excellent thanks guys! It’s working properly now!



1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments