Search Unity

Place a texture like a sticker

Discussion in 'Shaders' started by Kahel_, Nov 16, 2014.

  1. Kahel_

    Kahel_

    Joined:
    Nov 9, 2014
    Posts:
    8
    Hello,

    I try to make or find a shader that allow me to place and scale a texture on a mesh like a sticker, I mean: a texture that is not "repeated". Changing his position on the mesh and his scale with 4 variables. But I have no idea to how to do this.
    Thanks.
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
  3. Kahel_

    Kahel_

    Joined:
    Nov 9, 2014
    Posts:
    8
    It seem to be a complicated method, I would to use a shader...
    Thank you anyway!
     
  4. mouurusai

    mouurusai

    Joined:
    Dec 2, 2011
    Posts:
    350
    No, it's easy way. Another ways is:
    Create another one object with suitable uv and draw it with shader with some Offset.
    Create shader and pass into it some matrix or vector for texture projection purposes.
     
  5. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    I did something like this but i use component instead of shader. My script grabs the mesh, pick the triangles in area, calculate the uv, and render it on the surface of the original object. It's good because my script can cache the generated new mesh, and use any shader for the sticker. As what they say, projecter is the most easiest way to do the sticker effect.
     
  6. Kahel_

    Kahel_

    Joined:
    Nov 9, 2014
    Posts:
    8
    SunnyChow> You're method interests me because I guess it allows me to add any number of textures and apply shader by texture. What do you mean by "cache the mesh"? I think I have to learn really much more about "graphic things" in unity because I understand nothing about to "pick the triangles in area".
    mouurusai> "Create another one object with suitable uv and draw it with shader with some Offset."
    This method seem to be very suitable to my context, now I have to learn to work with UV.

    Thank you both!
     
  7. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
    You might be looking something like a decal system.
     
  8. Kahel_

    Kahel_

    Joined:
    Nov 9, 2014
    Posts:
    8
    I heard about decal but I always have the problem the texture is "repeated".
     
  9. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Set the texture to "clamped" - only to be found under Advanced Texture settings.