- Home /
Shader not changing according to scene light in real time.
So I have a custom unlit shader that is affected by the ambient light in the scene and it works perfectly fine. However, one problem that I have is that it doesn't seem to update in real time. If I change the colour of the skybox, the standard URP shader will instantly react to it, but for my custom shader, I have to go into the shadergraph to do a slight change to update it (not doing anything, just expanding the window is enough to refresh it). So I was wondering if there is any way I can make it instantly refresh eveytime the ambiental light is changed. I am currently using this custom script to take the ambiental light information.
 void GetAmbientalInformation_half(out float3 SkyColor, out float3 EquatorColor, out float3 GroundColor)
 {    
         #ifdef SHADERGRAPH_PREVIEW
             SkyColor = (1, 1, 1, 1);
             EquatorColor = (1, 1, 1, 1);
             GroundColor = (1, 1, 1, 1);
         #else
             SkyColor = unity_AmbientSky;
             GroundColor = unity_AmbientGround;
             EquatorColor = unity_AmbientEquator;
         #endif
 }
 
Thank you in advance.
Answer by Lunastras · Jun 29, 2020 at 07:44 AM
Nevermind, apparently there is a node for ambiental lighting. https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Ambient-Node.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                