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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Resolved Get a Sample Texture 2D in shader graph

Discussion in 'Shader Graph' started by Eidern, Aug 11, 2022.

  1. Eidern

    Eidern

    Joined:
    Mar 29, 2014
    Posts:
    94
    Hello,
    I got a simple 2D sprite with alpha transparency, the sprite is displayed correctly (I mean with it's transparent background) if I draw it on screen with a 2d sprite component.

    But When I try to do the exact same thing with shader graph by multiplying the texture 2D color with it's alpha, I get the sprite displayed with a black background intstead of its transparency..
    Capture d’écran 2022-08-11 à 23.15.04.png

    What do I Do wrong?
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,112
    Base Color is Vector3, so it has only RGB without any information about transparency, you should just put 'A' channel of texture into Alpha of Fragment output.
     
    Eidern likes this.
  3. Eidern

    Eidern

    Joined:
    Mar 29, 2014
    Posts:
    94
    Oh , As I saw that the output was rgbA(4), I assumed that it got the transparency too..
    You're right it was as simple as that ..
    Thanks again :)