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

Change sky cubemap reflection color in surface shader

Discussion in 'Shaders' started by DanielZeller, Aug 15, 2017.

  1. DanielZeller

    DanielZeller

    Joined:
    Nov 18, 2014
    Posts:
    17
    Hi,

    I'm trying to change the color of the baked skybox cubemap within a surface shader during runtime.
    In Unity 5.4 I used to be able to do so by including my own verison of UnityGlobalIllumination.cginc in the same folder as my surface shader and then change the UnityGI_IndirectSpecular method like this:

    Code (Shader code):
    1. inline half3 UnityGI_IndirectSpecular(UnityGIInput data, half occlusion, half3 normalWorld, Unity_GlossyEnvironmentData glossIn)
    2. {
    3.      half3 specular=  Unity_GlossyEnvironment (UNITY_PASS_TEXCUBE(unity_SpecCube0), data.probeHDR[0],    glossIn) * mySkyReflectionTint;
    4.      return specular * occlusion;
    5. }
    mySkyReflectionTint is set in C# using
    Code (CSharp):
    1. Shader.setGlobalColor("mySkyReflectionTint", color);
    The problem is that in Unity 2017 the UnityGI_IndirectSpecular method has been deprecated and I can't figure out to do it in 2017. I also can't find any references to UNITY_PASS_TEXCUBE or unity_SpecCube0 in any of the cg includes.
    If anyone can help or point me in the right direction it would be much appreciated.
     
    Daerst likes this.