+1
ShaderForge shaders produce inverted colors in Unity 5
I created this shader in Unity 4.5 with ShaderForge beta 0.36. I updated to Unity 5 Beta 19 and ShaderForge 1.04. The shader produced colors that seemed to be inverted in value.
One of our graphics programmers found that the #defines have changed in Unity 5 and suspected that the ShaderForge shader from 4.5 needed to utilize those new #defines. Once changed to the new #defines, the shader seems to function properly.
Here are the code changes:
#if defined (SHADER_API_GLES) || defined (SHADER_API_GLES3)
lightAccumulation = max(lightAccumulation, half4(0.001));
#endif
#ifndef HDR_LIGHT_PREPASS_ON
lightAccumulation = -log2(lightAccumulation);
#endif
#if defined (SHADER_API_XBOX360) && defined (HDR_LIGHT_PREPASS_ON)
lightAccumulation.w = tex2Dproj (_LightSpecBuffer, UNITY_PROJ_COORD(i.projPos)).r;
#endif
to
#if defined (SHADER_API_MOBILE)
lightAccumulation = max(lightAccumulation, half4(0.001));
#endif
#ifndef UNITY_HDR_ON
lightAccumulation = -log2(lightAccumulation);
#endif
#if defined (SHADER_API_XBOX360) && defined (UNITY_HDR_ON)
lightAccumulation.w = tex2Dproj (_LightSpecBuffer, UNITY_PROJ_COORD(i.projPos)).r;
#endif
The shader used both vertex blending (for diffuse albedo) alpha clipping for transparency, under defferred pre-pass lighting. Hope this helps!
J-Small
One of our graphics programmers found that the #defines have changed in Unity 5 and suspected that the ShaderForge shader from 4.5 needed to utilize those new #defines. Once changed to the new #defines, the shader seems to function properly.
Here are the code changes:
#if defined (SHADER_API_GLES) || defined (SHADER_API_GLES3)
lightAccumulation = max(lightAccumulation, half4(0.001));
#endif
#ifndef HDR_LIGHT_PREPASS_ON
lightAccumulation = -log2(lightAccumulation);
#endif
#if defined (SHADER_API_XBOX360) && defined (HDR_LIGHT_PREPASS_ON)
lightAccumulation.w = tex2Dproj (_LightSpecBuffer, UNITY_PROJ_COORD(i.projPos)).r;
#endif
to
#if defined (SHADER_API_MOBILE)
lightAccumulation = max(lightAccumulation, half4(0.001));
#endif
#ifndef UNITY_HDR_ON
lightAccumulation = -log2(lightAccumulation);
#endif
#if defined (SHADER_API_XBOX360) && defined (UNITY_HDR_ON)
lightAccumulation.w = tex2Dproj (_LightSpecBuffer, UNITY_PROJ_COORD(i.projPos)).r;
#endif
The shader used both vertex blending (for diffuse albedo) alpha clipping for transparency, under defferred pre-pass lighting. Hope this helps!
J-Small
Servicio de atención al cliente por UserEcho
This bug has been confirmed by Aras, one of the Unity developers HERE.