Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Accessing stretched and tiled linerenderer UV in one shader

Discussion in 'General Graphics' started by UDesoxi, Sep 20, 2022.

  1. UDesoxi

    UDesoxi

    Joined:
    Jan 6, 2022
    Posts:
    2
    Hey everyone,

    I am currently trying to find a way to access the stretched and tiled UV in a single shader. The issue with either one is, that I need part of a texture to be tiled, whereas the rest can and should be using the stretched UV.

    Of course I experimented with using stretched and applying the tiling myself, but depending on the linerenderer length, this leads to weird scaling of the tiles, which I only can mitigate if I compute the exact length of the line before (which I can not do for performance reasons).

    However I noticed that the tile texture mode of the built in linerenderer does not suffer from this scale issues when the line has different lengths and I don't really understand how the accomplished this.

    Any tips in the right direction would be appreciated.
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,240
    You can’t - we only send one or the other to the shader depending on the active mode
     
  3. UDesoxi

    UDesoxi

    Joined:
    Jan 6, 2022
    Posts:
    2
    I see, that is unfortunate. However, I found a good workaround using the color gradient of the linerenderer. Thank you @richardkettlewell for the quick response.
     
    richardkettlewell likes this.