Search Unity

Resolved HDRP Lit shader is not working properly (shows all black)

Discussion in 'Shaders' started by NearlyClose, Jan 15, 2021.

  1. NearlyClose

    NearlyClose

    Joined:
    Dec 26, 2020
    Posts:
    3
    Hi friends,

    I hope someone can help.

    I created Texture2d in a script:

    Code (CSharp):
    1. Texture2D texture = new Texture2D(width, height);
    2.         texture.SetPixels(colorMap);
    3.         texture.filterMode = FilterMode.Trilinear;
    4.         texture.wrapMode = TextureWrapMode.Clamp;
    5.         texture.anisoLevel = 9;
    6.         texture.Apply();
    and used it in SetTexture:

    Code (CSharp):
    1.         textureRenderer.material.SetTexture("_BaseColorMap", texture);
    2.  
    I can see the texture in the inspector view, but it's all black in the scene or game view (can't be due to bad lighting as the tree in the scene is clearly visible, I think):

    upload_2021-1-15_21-50-43.png

    Unity ver. 2020.2.0f1
     
  2. NearlyClose

    NearlyClose

    Joined:
    Dec 26, 2020
    Posts:
    3
    I found the bug. The plane's Y scale is set to 0, which was the problem. Worked fine for the Unlit shader though, thus my confusion.