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. Dismiss Notice

[Solved]Texture Blending with Clamped(Non-Repeat) Image?

Discussion in 'Shaders' started by gdosu, Aug 11, 2021.

  1. gdosu

    gdosu

    Joined:
    Aug 24, 2020
    Posts:
    13
    Hey all.

    I'm trying to blend two texture while using single shader and material, one texture is for background, the other is kinda logo.

    But when I tried to "resize" logo(from adjusting tiling and offset), the "outside" of logo is messed up.





    Is there any way to prevent this? Many thanks for reading.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    What does your shader look like? And does your “logo” texture have an alpha channel / transparency?

    Usually for something like a “logo” it’ll have a transparency and you use a
    lerp()
    to blend between the background and the logo, which is the same way it works if you were to use a logo as a sprite or with an otherwise transparent material. However if the art goes all the way to the edge of the texture, you’ll additionally need to clamp the area you blend by the 0.0 to 1.0 range of the logo’s UVs.
     
    gdosu likes this.
  3. gdosu

    gdosu

    Joined:
    Aug 24, 2020
    Posts:
    13
    Thanks for answer! This shader is based on default standard surface shader, so I didn't write much code yet.
    Now then I'll separate logo map to one for albedo, the other for alpha, and gonna study further about clamping uvs. Again, thanks for answer.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    Why? You’re better off using a single texture that already has transparency.
     
  5. gdosu

    gdosu

    Joined:
    Aug 24, 2020
    Posts:
    13
    um.. for preparing non-transparent logo? I'm trying to make kinda "interface" shader for co-oping with designer. (unfortunately I'm new to shader things) I'll discuss about that. Thanks for advise!
     
    Last edited: Aug 12, 2021