Search Unity

Light probes and specular

Discussion in 'Shaders' started by Bravo_cr, Oct 22, 2014.

  1. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Hi,

    I have been reading all the post related to how to maintain specular when using light probes in a surface shader.

    The problem is as soon as I enable probes on the object the specular is turn off. I have track down the "issue" to this line in the Lightning function:

    Code (CSharp):
    1. c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * s.SpecularColor * spec ) * (atten * 2) ;
    The problem is that the info which comes with _LightColor0.rgb in _LightColor0.rgb*s.SpecularColor*spec kills the specular. If I remove that it works, but I loose the light color in the specular and the light intensity.

    The idea is having the light probes only affecting only color per vertex and take the specular from a directional light. ¿Any ideas of how it can be done?

    Cheers,