+4

Light Probes and Ambient light is broken in default PBR/deferred shader

warby il y a 6 ans mis à jour par Oliver Iking il y a 6 ans 1

Since a recent unity update all my custom shaders are way too dark with a bit of research I figured out the issue is that dynamic objects that use a shaderforge shader that is set to deferred ( camera is set to deferred too obviously) no longer receive ambient light or bounce light from light probes. I created a new fresh "Liit PBR Shader" via shaderforge set it to deferred and it was immediately black so I can rule out that anything that I am doing with my shaders causes this. Static objects with the same custom shader receive ambient lighting and bounce light via enlighten just fine ... nothing broken there. Would be great if you could change your shader code output to be compatible with the newest unity version ( which at time of this writing is 2017.3.0f3 )


the example scene/project from the screenshot can be downloaded here:


https://www.dropbox.com/s/1rk2huoe6yyqkhk/ShaderForgeAndLightProbesBroken.7z?dl=1


Image 902

+1

I solved this problem for us by:


- Slightly modifying the SF source code:

Index: ShaderForge/Editor/Code/_Evaluator/SF_Evaluator.cs
===================================================================
--- 
@@ -629,6 +629,7 @@
 
  if( currentPass == PassType.Deferred ) {
  App( "#pragma multi_compile ___ UNITY_HDR_ON" );
+ App("#pragma multi_compile_prepassfinal");
  }
 
  if( LightmappedAndLit() ) {

- Enabled the "Force no custom shadow pass" in the "Experimental" tab for all the shaders