Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question SkyBox Transition/Using HDRIs in Shader Graph as textures

Discussion in 'Shader Graph' started by MindwayTechC, Jul 20, 2022.

  1. MindwayTechC

    MindwayTechC

    Joined:
    Jun 24, 2022
    Posts:
    4
    Hi

    What I'm trying to achieve is to be able to edit alpha/transparency of a skybox material so that I can make a transition between 2 skybox textures during a scene.
    I don't know much about scripting but I'm kinda comfortable around shader graph nodes.

    Is there a way I can use a cubemap or a panaromic texture as a sample texture assets which then I can use it as a skybox material.

    In the most simple way I dragged the texture in shader graph and connected it to the base color however this either turns the sky completely black or shows only 1 face of a cube in the world space.
     
  2. Ben_at_Work

    Ben_at_Work

    Joined:
    Mar 16, 2022
    Posts:
    79
    Make sure the material you're using is set to a render queue of 1000, which is for the background layer. Shader Graph doesn't seem to offer a convenient way to set it on the shader, but it can always be assigned under the Advanced Options of any given material. Unity will complain about a shader not being recognized as a skybox if it's not on that layer.

    For assigning the cubemap, I assume you'll need to make sure you're using a Cubemap property and not a texture, and a corresponding Sample Cubemap node.

    I don't know why but if you disabled Cast Shadows on the shader, it will only show one side of the cubemap (at least for me). I had to enable it to get the correct behavior back.

    This was my quick attempt at a simple skybox, and even this is flipped upside down.
    basicSkybox.PNG
     
    MindwayTechC likes this.