summaryrefslogtreecommitdiff
path: root/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Includes/CGI_PoiBlackLight.cginc
blob: db5532080e21532785baf7f9eb86443db32eb59e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef POI_BLACKLIGHT
    #define POI_BLACKLIGHT
    
    float4 _BlackLightMaskStart;
    float4 _BlackLightMaskEnd;
    float4 _BlackLightMaskKeys;
    float _BlackLightMaskDebug;
    uint _BlackLightMaskDissolve;
    uint _BlackLightMaskMetallic;
    uint _BlackLightMaskClearCoat;
    uint _BlackLightMaskMatcap;
    uint _BlackLightMaskMatcap2;
    uint _BlackLightMaskEmission;
    uint _BlackLightMaskEmission2;
    uint _BlackLightMaskFlipbook;
    uint _BlackLightMaskPanosphere;
    uint _BlackLightMaskIridescence;
    
    half _BlackLightMaskGlitter;
    
    half4 blackLightMask;
    
    void createBlackLightMask()
    {
        blackLightMask = 0;
        #ifdef VERTEXLIGHT_ON
            
            for (int lightIndex = 0; lightIndex < 4; lightIndex ++)
            {
                float3 lightPos = float3(unity_4LightPosX0[lightIndex], unity_4LightPosY0[lightIndex], unity_4LightPosZ0[lightIndex]);
                if (!distance(unity_LightColor[lightIndex].rgb, float3(0, 0, 0)))
                {
                    for (int maskIndex = 0; maskIndex < 4; maskIndex ++)
                    {
                        if(unity_LightColor[lightIndex].a == _BlackLightMaskKeys[maskIndex])
                        {
                            blackLightMask[maskIndex] = max(blackLightMask[maskIndex], smoothstep(_BlackLightMaskEnd[maskIndex], _BlackLightMaskStart[maskIndex], distance(poiMesh.worldPos, lightPos)));
                        }
                    }
                }
            }
        #endif
    }
#endif

/*
#ifdef POI_BLACKLIGHT
    if (_BlackLightMaskDissolve != 4)
    {
        blackLightMask[mask];
    }
#endif
*/