public MainLightShadowCasterPass(RenderPassEvent evt)
        {
            test_pcfDefine  = PCFDefine.Instance;
            renderPassEvent = evt;

            m_MainLightShadowMatrices = new Matrix4x4[k_MaxCascades + 1];
            m_CascadeSlices           = new ShadowSliceData[k_MaxCascades];
            m_CascadeSplitDistances   = new Vector4[k_MaxCascades];

            MainLightShadowConstantBuffer._WorldToShadow = Shader.PropertyToID("_MainLightWorldToShadow");
            MainLightShadowConstantBuffer._ShadowParams  = Shader.PropertyToID("_MainLightShadowParams");
            MainLightShadowConstantBuffer._CascadeShadowSplitSpheres0    = Shader.PropertyToID("_CascadeShadowSplitSpheres0");
            MainLightShadowConstantBuffer._CascadeShadowSplitSpheres1    = Shader.PropertyToID("_CascadeShadowSplitSpheres1");
            MainLightShadowConstantBuffer._CascadeShadowSplitSpheres2    = Shader.PropertyToID("_CascadeShadowSplitSpheres2");
            MainLightShadowConstantBuffer._CascadeShadowSplitSpheres3    = Shader.PropertyToID("_CascadeShadowSplitSpheres3");
            MainLightShadowConstantBuffer._CascadeShadowSplitSphereRadii = Shader.PropertyToID("_CascadeShadowSplitSphereRadii");
            MainLightShadowConstantBuffer._ShadowmapSize = Shader.PropertyToID("_MainLightShadowmapSize");

            m_MainLightShadowmap.Init("_MainLightShadowmapTexture");
            m_SupportsBoxFilterForShadows = Application.isMobilePlatform || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Switch;
        }
Example #2
0
    private void Awake()
    {
        Instance = this;
        List <string> pcfList = new List <string>();

        foreach (PCFType t in Enum.GetValues(typeof(PCFType)))
        {
            pcfList.Add(t.ToString());
        }
        dd.AddOptions(pcfList);
        dd.onValueChanged.AddListener(delegate
        {
            SwitchType((PCFType)dd.value);
        });

        distanceSlider.onValueChanged.AddListener(delegate
        {
            disSliderTxt.text         = Mathf.Floor(distanceSlider.value).ToString();
            urpSetting.shadowDistance = distanceSlider.value;
        });
        shadowResolutionToggle.onValueChanged.AddListener(delegate
        {
            if (shadowResolutionToggle.isOn)
            {
                urpSetting.mainLightShadowmapResolution = 4096;
            }
            else
            {
                urpSetting.mainLightShadowmapResolution = 2048;
            }
        });

        biasSlider.onValueChanged.AddListener(delegate
        {
            biasSliderTxt.text         = biasSlider.value.ToString().Substring(0, 4);
            urpSetting.shadowDepthBias = biasSlider.value;
        });
    }