Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Import or Linear/Gama change conversion of cookies in linear mode fails again

Discussion in '2017.1 Beta' started by Quatum1000, Apr 24, 2017.

  1. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi,

    Import or Linear/Game change conversion of cookies in linear mode fails since a long time.

    Untitled-2.jpg

    Changing the UnityDeferredLibrary.cginc to

    Code (CSharp):
    1.     // spot light case
    2. #if defined (SPOT)
    3.     float3 tolight = _LightPos.xyz - wpos;
    4.     half3 lightDir = normalize(tolight);
    5.  
    6.     float4 uvCookie = mul(unity_WorldToLight, float4(wpos, 1));
    7.     // negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/
    8.     float atten = tex2Dbias(_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w ;
    9.  
    10.     atten *= uvCookie.w < 0;
    11.     //float att = dot(tolight, tolight) * _LightPos.w;
    12.     //atten *= tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
    13.     atten *= UnityDeferredComputeShadow(wpos, fadeDist, uv);
    14.  
    15.     // Quatum1000 2017 Hack
    16.     // Cookie textures are not correctly Linear Space converted since U4.6
    17.     if (!IsGamaSpace()) atten *= atten;  //Cheap pow(atten, 2.2)
    fix the problem as work around. But I do not want to hack the internal shader.