Line/Trail Renderer Improvements

Regarding the new line and trail renderer improvements, has UV handling been improved much?

In particular, is it possible to create a line with a tiling texture without having to override the material tiling property to match the length of the line?

As it is, for elements rendered with a line renderer where we have to use constant tiling, we use MPBs, which is not entirely ideal.

Hey,

In short, no, unfortunately we haven’t improved the UV handling.

However, this did come up internally when we were developing the other improvements. I think it’s something we will aim to address in the near future. It’s on our internal roadmap.

Sorry it’s not the answer you were hoping for!

Ah, a bit of a shame that the opportunity was missed for this release but it’s not the end of the world!

1 Like

I wanted to get back in touch, because your question prompted me to assess how easy this would be to support, to see if we could squeeze it into 5.5.

The good news is that it proved to be simple, so it will be available in 5.5.0b3!

The line and trail renderers (including particle trails) now have a texture mode option of either Stretch (current behavior) or Tile (new behavior).

When tiling is active, the material can control the amount of tiling.

11 Likes

Beautiful! :smiley:

I shall test the changes when b3 is released!

1 Like

So, tested the changes, everything works as expected, as far as the UV options go, it’s great! :slight_smile:

The only oddness I noticed is handling of the inserted vertices when smoothing corners.

It seems that the UV’s (and presumably the rest of the attributes) are duplicated from the first pair of vertices of the corner, rather than interpolated. Is this intentional?

1 Like

Great!

Regarding the smooth corners, currently yes, that’s expected. We may look to do something smarter in the future :slight_smile:

2 Likes

I played with Trails in Unity, and I am also very interested in how UV’s are applied. V is great as-is. I would like the ability to make a smoke trail or tank tread. To do this, imagine that the texture is fixed to the world, rather than relative to the parametric space of the curve.

To better explain, I would like a tile mode where U coordinates are fixed on points on the trail (i.e. not relative to the points parametric space in the trail). Imagine a smoke texture that tiles in U. The parent particle of the trail places points in a trail curve, where each point has a position and a U coordinate. The U coordinate starts at 0 when the particle is first born. The current U coordinate needs to be a state of the particle. A user would specify a “Tiling Distance”, so the scale factor would be “1 / tilingDistance”. Another bonus would be to add a toggle for “Size Effects Tiling” that adjusts the scale factor to be “1 / (tilingDistance * size)”

If a user specifies a tiling distance of 5, and the particle travels 5 units in a frame, then the corresponding U coordinate that the particle deposits into the trail’s second point in the curve is 1 (the first point is 0). The U value of a point on the curve doesn’t change over time, thereby anchoring the texture to world space. To support tiling, the parent particles current U value simply increments to values greater than one over time. To continue my example, after 10 frames, the particle travelled 50 units, and the instantaneous u value at the particle is 5. Supposing that the trail curve had 5 points, the u values at each trail point would be 0, 1, 2, 3, 4.

A bonus would be to randomize the starting u value (0…1) so that particles born in the same location don’t have identical areas of the tiling texture.

2 Likes