public bool Setup(ScriptableRenderer renderer, ref RenderingData renderingData) { int shadowLightIndex = renderingData.lightData.mainLightIndex; if (shadowLightIndex == -1) { return(false); } VisibleLight shadowLight = renderingData.lightData.visibleLights[shadowLightIndex]; Light light = shadowLight.light; if (light.shadows == LightShadows.None) { return(false); } if (shadowLight.lightType != LightType.Directional) { Debug.LogWarning("Only directional lights are supported as main light."); } Bounds bounds; if (!renderingData.cullResults.GetShadowCasterBounds(shadowLightIndex, out bounds)) { return(false); } //TODO : More branches _CountBuffer = renderer.GetBuffer(ComputeBufferHandle.DeepShadowMapsCount); _DataBuffer = renderer.GetBuffer(ComputeBufferHandle.DeepShadowMapsData); return(true); }
public bool Setup(ScriptableRenderer renderer, RenderTextureDescriptor baseDescriptor, RenderTargetHandle destination, ref RenderingData renderingData) { //int shadowLightIndex = renderingData.lightData.mainLightIndex; //if (shadowLightIndex == -1) // return false; //VisibleLight shadowLight = renderingData.lightData.visibleLights[shadowLightIndex]; //Light light = shadowLight.light; //if (light.shadows == LightShadows.None) // return false; //if (shadowLight.lightType != LightType.Directional) //{ // Debug.LogWarning("Only directional lights are supported as main light."); //} //Bounds bounds; //if (!renderingData.cullResults.GetShadowCasterBounds(shadowLightIndex, out bounds)) // return false; //TODO : More branches _CountBuffer = renderer.GetBuffer(ComputeBufferHandle.DeepShadowMapsCount); _DataBuffer = renderer.GetBuffer(ComputeBufferHandle.DeepShadowMapsData); _Destination = destination; _Descriptor = baseDescriptor; _Descriptor.colorFormat = _ShadowLutFormat; _Descriptor.depthBufferBits = 0; _DeepShadowLut.Init("_DSMLut"); _DeepShadowTmp.Init("_DSMTmp"); _DeepShadowTest.Init("_DeepShadowTest"); return(true); }