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

Question How to add a solid color background where there is transparency?

Discussion in 'Shader Graph' started by cathode26, Aug 16, 2022.

  1. cathode26

    cathode26

    Joined:
    Jul 21, 2011
    Posts:
    27
    Can someone tell me the correct way to blend two images together so that I am taking a background image and putting it behind the girl sprite?

    The problem I am having is that the size of the background is not what I want it to be.

    The 2nd image I attached is of the sprite editor and it shows that there is a lot more transparency and I want all of the transparency to be black.

    upload_2022-8-16_9-59-2.png


    upload_2022-8-16_9-26-45.png

    upload_2022-8-16_10-34-55.png
     

    Attached Files:

    Last edited: Aug 16, 2022
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    Use
    lerp(background, image, image.alpha)

    This is what Blend with Override mode should do.
     
    cathode26 likes this.
  3. cathode26

    cathode26

    Joined:
    Jul 21, 2011
    Posts:
    27
    Thanks, I used lerp and that helped!
    Also I found out why the sprite was cut.
    I needed to change the Mesh Type from Tight to Full Rect.

    upload_2022-8-16_21-14-22.png