private void SetupMainLightConstants(CommandBuffer cmd, List <VisibleLight> lights, int lightIndex) { Vector4 lightPos, lightColor, lightDistanceAttenuation, lightSpotDir, lightSpotAttenuation; InitializeLightConstants(lights, lightIndex, out lightPos, out lightColor, out lightDistanceAttenuation, out lightSpotDir, out lightSpotAttenuation); if (lightIndex >= 0) { UnityEngine.LightType mainLightType = lights[lightIndex].lightType; Light mainLight = lights[lightIndex].light; if (LightweightUtils.IsSupportedCookieType(mainLightType) && mainLight.cookie != null) { Matrix4x4 lightCookieMatrix; LightweightUtils.GetLightCookieMatrix(lights[lightIndex], out lightCookieMatrix); cmd.SetGlobalTexture(PerCameraBuffer._MainLightCookie, mainLight.cookie); cmd.SetGlobalMatrix(PerCameraBuffer._WorldToLight, lightCookieMatrix); } } cmd.SetGlobalVector(PerCameraBuffer._MainLightPosition, lightPos); cmd.SetGlobalVector(PerCameraBuffer._MainLightColor, lightColor); cmd.SetGlobalVector(PerCameraBuffer._MainLightDistanceAttenuation, lightDistanceAttenuation); cmd.SetGlobalVector(PerCameraBuffer._MainLightSpotDir, lightSpotDir); cmd.SetGlobalVector(PerCameraBuffer._MainLightSpotAttenuation, lightSpotAttenuation); }
public void Blit(ScriptableRenderContext context, RenderTargetIdentifier currCameraColorRT, FrameRenderingConfiguration renderingConfig, Camera camera) { var cmd = CommandBufferPool.Get("Blit"); if (m_IntermediateTextureArray) { cmd.Blit(currCameraColorRT, BuiltinRenderTextureType.CameraTarget); } else if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.IntermediateTexture)) { Material blitMaterial = m_BlitMaterial; if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.Stereo)) { blitMaterial = null; } // If PostProcessing is enabled, it is already blit to CameraTarget. if (!LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.PostProcess)) { Blit(cmd, renderingConfig, currCameraColorRT, BuiltinRenderTextureType.CameraTarget, camera, blitMaterial); } } SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget, camera.backgroundColor); context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
public static void Start(ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfiguration, Camera currentCamera) { if (LightweightUtils.HasFlag(renderingConfiguration, FrameRenderingConfiguration.Stereo)) { context.StartMultiEye(currentCamera); } }
private void SetupIntermediateRenderTextures(CommandBuffer cmd, FrameRenderingConfiguration renderingConfig, int msaaSamples, CameraContext cameraContext, RenderTargetIdentifier ColorRT) { var camera = cameraContext.Camera; RenderTextureDescriptor baseDesc; if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.Stereo)) { baseDesc = XRSettings.eyeTextureDesc; } else { baseDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight); } float renderScale = (camera.cameraType == CameraType.Game) ? m_Asset.RenderScale : 1.0f; baseDesc.width = (int)((float)baseDesc.width * renderScale); baseDesc.height = (int)((float)baseDesc.height * renderScale); // TODO: Might be worth caching baseDesc for allocation of other targets (Screen-space Shadow Map?) if (m_RequireDepthTexture) { var depthRTDesc = baseDesc; depthRTDesc.colorFormat = RenderTextureFormat.Depth; depthRTDesc.depthBufferBits = kDepthStencilBufferBits; cmd.GetTemporaryRT(CameraRenderTargetID.depth, depthRTDesc, FilterMode.Bilinear); if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.DepthCopy)) { cmd.GetTemporaryRT(CameraRenderTargetID.depthCopy, depthRTDesc, FilterMode.Bilinear); } } var colorRTDesc = baseDesc; colorRTDesc.colorFormat = m_ColorFormat; colorRTDesc.depthBufferBits = kDepthStencilBufferBits; // TODO: does the color RT always need depth? colorRTDesc.sRGB = true; colorRTDesc.msaaSamples = msaaSamples; colorRTDesc.enableRandomWrite = false; // When offscreen camera current rendertarget is CameraTarget if (!cameraContext.IsOffscreenCamera) { cmd.GetTemporaryRT(CameraRenderTargetID.color, colorRTDesc, FilterMode.Bilinear); m_CurrCameraColorRT = ColorRT; } // When BeforeTransparent PostFX is enabled and only one effect is in the stack we need to create a temp // color RT to blit the effect. if (m_RequireCopyColor) { cmd.GetTemporaryRT(CameraRenderTargetID.copyColor, colorRTDesc, FilterMode.Point); } }
public TextureUtil(CustomRenderPipelineAsset asset) { m_Asset = asset; m_CopyTextureSupport = SystemInfo.copyTextureSupport; m_BlitQuad = LightweightUtils.CreateQuadMesh(false); m_BlitMaterial = CoreUtils.CreateEngineMaterial(asset.BlitShader); m_CopyDepthMaterial = CoreUtils.CreateEngineMaterial(asset.CopyDepthShader); m_PostProcessRenderContext = new PostProcessRenderContext(); }
private void AfterTransparent(ref ScriptableRenderContext context, FrameRenderingConfiguration config, CameraContext cameraContext) { if (!LightweightUtils.HasFlag(config, FrameRenderingConfiguration.PostProcess)) { return; } CommandBuffer cmd = CommandBufferPool.Get("After Transparent"); m_TextureUtil.RenderPostProcess(cmd, m_TextureUtil.CurrCameraColorRT, BuiltinRenderTextureType.CameraTarget, false, cameraContext.Camera); context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
private void AfterOpaque(ref ScriptableRenderContext context, FrameRenderingConfiguration config, CameraContext cameraContext) { if (!m_TextureUtil.RequireDepthTexture) { return; } CommandBuffer cmd = CommandBufferPool.Get("After Opaque"); cmd.SetGlobalTexture(CameraRenderTargetID.depth, m_DepthRT); bool setRenderTarget = false; RenderTargetIdentifier depthRT = m_DepthRT; var camera = cameraContext.Camera; // TODO: There's currently an issue in the PostFX stack that has a one frame delay when an effect is enabled/disabled // when an effect is disabled, HasOpaqueOnlyEffects returns true in the first frame, however inside render the effect // state is update, causing RenderPostProcess here to not blit to FinalColorRT. Until the next frame the RT will have garbage. if (LightweightUtils.HasFlag(config, FrameRenderingConfiguration.BeforeTransparentPostProcess)) { // When only have one effect in the stack we blit to a work RT then blit it back to active color RT. // This seems like an extra blit but it saves us a depth copy/blit which has some corner cases like msaa depth resolve. if (m_TextureUtil.RequireCopyColor) { m_TextureUtil.RenderPostProcess(cmd, m_TextureUtil.CurrCameraColorRT, m_CopyColorRT, true, camera); cmd.Blit(m_CopyColorRT, m_TextureUtil.CurrCameraColorRT); } else { m_TextureUtil.RenderPostProcess(cmd, m_TextureUtil.CurrCameraColorRT, m_TextureUtil.CurrCameraColorRT, true, camera); } setRenderTarget = true; m_TextureUtil.SetRenderTarget(cmd, m_TextureUtil.CurrCameraColorRT, m_DepthRT, camera.backgroundColor); } if (LightweightUtils.HasFlag(config, FrameRenderingConfiguration.DepthCopy)) { m_TextureUtil.CopyTexture(cmd, m_DepthRT, m_CopyDepth); depthRT = m_CopyDepth; setRenderTarget = true; } if (setRenderTarget) { m_TextureUtil.SetRenderTarget(cmd, m_TextureUtil.CurrCameraColorRT, depthRT, camera.backgroundColor); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
private void BeginForwardRendering(ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfig, CameraContext cameraContext) { RenderTargetIdentifier colorRT = BuiltinRenderTextureType.CameraTarget; RenderTargetIdentifier depthRT = BuiltinRenderTextureType.None; StereoRendering.Start(ref context, renderingConfig, cameraContext.Camera); CommandBuffer cmd = CommandBufferPool.Get("SetCameraRenderTarget"); bool intermediateTexture = LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.IntermediateTexture); if (intermediateTexture) { if (!cameraContext.IsOffscreenCamera) { colorRT = m_TextureUtil.CurrCameraColorRT; } if (m_TextureUtil.RequireDepthTexture) { depthRT = m_DepthRT; } } ClearFlag clearFlag = ClearFlag.None; CameraClearFlags cameraClearFlags = cameraContext.Camera.clearFlags; if (cameraClearFlags != CameraClearFlags.Nothing) { clearFlag |= ClearFlag.Depth; if (cameraClearFlags == CameraClearFlags.Color || cameraClearFlags == CameraClearFlags.Skybox) { clearFlag |= ClearFlag.Color; } } m_TextureUtil.SetRenderTarget(cmd, colorRT, depthRT, cameraContext.Camera.backgroundColor, clearFlag); // If rendering to an intermediate RT we resolve viewport on blit due to offset not being supported // while rendering to a RT. if (!intermediateTexture && !LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.DefaultViewport)) { cmd.SetViewport(cameraContext.Camera.pixelRect); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
public void SetupIntermediateResources(FrameRenderingConfiguration renderingConfig, ref ScriptableRenderContext context, CameraContext cameraContext, RenderTargetIdentifier colorRT) { CommandBuffer cmd = CommandBufferPool.Get("Setup Intermediate Resources"); int msaaSamples = (cameraContext.IsOffscreenCamera) ? Math.Min(cameraContext.Camera.targetTexture.antiAliasing, m_Asset.MSAASampleCount) : m_Asset.MSAASampleCount; msaaSamples = (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.Msaa)) ? msaaSamples : 1; m_CurrCameraColorRT = BuiltinRenderTextureType.CameraTarget; if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.IntermediateTexture) || m_RequireDepthTexture) { SetupIntermediateRenderTextures(cmd, renderingConfig, msaaSamples, cameraContext, colorRT); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
private void EndForwardRendering(ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfig, CameraContext cameraContext) { // No additional rendering needs to be done if this is an off screen rendering camera if (cameraContext.IsOffscreenCamera) { return; } var camera = cameraContext.Camera; m_TextureUtil.Blit(context, m_TextureUtil.CurrCameraColorRT, renderingConfig, camera); if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.Stereo)) { context.StopMultiEye(camera); context.StereoEndRender(camera); } }
public void ShadowPass(List <VisibleLight> visibleLights, ref ScriptableRenderContext context, ref LightData lightData, CullResults cullResults, int unsortedIndex, Color backgroundColor) { m_ShadowMapRT = null; if (m_Asset.AreShadowsEnabled() && lightData.mainLightIndex != -1) { VisibleLight mainLight = visibleLights[lightData.mainLightIndex]; if (mainLight.light.shadows != LightShadows.None) { if (!LightweightUtils.IsSupportedShadowType(mainLight.lightType)) { Debug.LogWarning("Only directional and spot shadows are supported by LightweightPipeline."); Shadows = false; return; } // There's no way to map shadow light indices. We need to pass in the original unsorted index. // If no additional lights then no light sorting is performed and the indices match. int shadowOriginalIndex = (lightData.totalAdditionalLightsCount > 0) ? unsortedIndex : lightData.mainLightIndex; bool shadowsRendered = RenderShadows(ref cullResults, ref mainLight, shadowOriginalIndex, ref context, backgroundColor); if (shadowsRendered) { lightData.shadowMapSampleType = (m_Asset.ShadowSetting != ShadowType.SOFT_SHADOWS) ? LightShadows.Hard : mainLight.light.shadows; // In order to avoid shader variants explosion we only do hard shadows when sampling shadowmap in the lit pass. // GLES2 platform is forced to hard single cascade shadows. if (!m_ShadowSettings.screenSpace) { lightData.shadowMapSampleType = LightShadows.Hard; } } else { lightData.shadowMapSampleType = LightShadows.None; } Shadows = shadowsRendered; return; } } Shadows = false; return; }
void Blit(CommandBuffer cmd, FrameRenderingConfiguration renderingConfig, RenderTargetIdentifier sourceRT, RenderTargetIdentifier destRT, Camera camera, Material material = null) { cmd.SetGlobalTexture(m_BlitTexID, sourceRT); if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.DefaultViewport)) { cmd.Blit(sourceRT, destRT, material); } else { if (m_BlitQuad == null) { m_BlitQuad = LightweightUtils.CreateQuadMesh(false); } SetRenderTarget(cmd, destRT, camera.backgroundColor); cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); cmd.SetViewport(camera.pixelRect); cmd.DrawMesh(m_BlitQuad, Matrix4x4.identity, material); } }
public void ShadowCollectPass(List <VisibleLight> visibleLights, ref ScriptableRenderContext context, ref LightData lightData, FrameRenderingConfiguration frameRenderingConfiguration, Camera currentCamera) { if (!m_ShadowSettings.screenSpace) { return; } CommandBuffer cmd = CommandBufferPool.Get("Collect Shadows"); SetShadowCollectPassKeywords(cmd, visibleLights[lightData.mainLightIndex], ref lightData); // TODO: Support RenderScale for the SSSM target. Should probably move allocation elsewhere, or at // least propogate RenderTextureDescriptor generation if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.Stereo)) { var desc = XRSettings.eyeTextureDesc; desc.depthBufferBits = 0; desc.colorFormat = m_ShadowSettings.screenspaceShadowmapTextureFormat; cmd.GetTemporaryRT(m_ScreenSpaceShadowMapRTID, desc, FilterMode.Bilinear); } else { cmd.GetTemporaryRT(m_ScreenSpaceShadowMapRTID, currentCamera.pixelWidth, currentCamera.pixelHeight, 0, FilterMode.Bilinear, m_ShadowSettings.screenspaceShadowmapTextureFormat); } // Note: The source isn't actually 'used', but there's an engine peculiarity (bug) that // doesn't like null sources when trying to determine a stereo-ized blit. So for proper // stereo functionality, we use the screen-space shadow map as the source (until we have // a better solution). // An alternative would be DrawProcedural, but that would require further changes in the shader. cmd.Blit(m_ScreenSpaceShadowMapRT, m_ScreenSpaceShadowMapRT, m_ScreenSpaceShadowsMaterial); StereoRendering.Start(ref context, frameRenderingConfiguration, currentCamera); context.ExecuteCommandBuffer(cmd); StereoRendering.Stop(ref context, frameRenderingConfiguration, currentCamera); CommandBufferPool.Release(cmd); }
private void SetShaderKeywords(CommandBuffer cmd, ref LightData lightData, List <VisibleLight> visibleLights) { int vertexLightsCount = lightData.totalAdditionalLightsCount - lightData.pixelAdditionalLightsCount; int mainLightIndex = lightData.mainLightIndex; //TIM: Not used in shader for V1 to reduce keywords CoreUtils.SetKeyword(cmd, "_MAIN_LIGHT_DIRECTIONAL", mainLightIndex == -1 || visibleLights[mainLightIndex].lightType == UnityEngine.LightType.Directional); //TIM: Not used in shader for V1 to reduce keywords CoreUtils.SetKeyword(cmd, "_MAIN_LIGHT_SPOT", mainLightIndex != -1 && visibleLights[mainLightIndex].lightType == UnityEngine.LightType.Spot); //TIM: Not used in shader for V1 to reduce keywords CoreUtils.SetKeyword(cmd, "_SHADOWS_ENABLED", lightData.shadowMapSampleType != LightShadows.None); //TIM: Not used in shader for V1 to reduce keywords CoreUtils.SetKeyword(cmd, "_MAIN_LIGHT_COOKIE", mainLightIndex != -1 && LightweightUtils.IsSupportedCookieType(visibleLights[mainLightIndex].lightType) && visibleLights[mainLightIndex].light.cookie != null); CoreUtils.SetKeyword(cmd, "_ADDITIONAL_LIGHTS", lightData.totalAdditionalLightsCount > 0); CoreUtils.SetKeyword(cmd, "_MIXED_LIGHTING_SUBTRACTIVE", m_LightManager.MixedLightingSetup == MixedLightingSetup.Subtractive); CoreUtils.SetKeyword(cmd, "_VERTEX_LIGHTS", vertexLightsCount > 0); CoreUtils.SetKeyword(cmd, "SOFTPARTICLES_ON", m_TextureUtil.RequireDepthTexture && m_Asset.RequireSoftParticles); bool linearFogModeEnabled = false; bool exponentialFogModeEnabled = false; if (RenderSettings.fog) { if (RenderSettings.fogMode == FogMode.Linear) { linearFogModeEnabled = true; } else { exponentialFogModeEnabled = true; } } CoreUtils.SetKeyword(cmd, "FOG_LINEAR", linearFogModeEnabled); CoreUtils.SetKeyword(cmd, "FOG_EXP2", exponentialFogModeEnabled); }
// How main light is decided: // If shadows enabled, main light is always a shadow casting light. Directional has priority over local lights. // Otherwise directional lights have priority based on cookie support and intensity private int GetMainLight(List <VisibleLight> visibleLights) { int totalVisibleLights = visibleLights.Count; bool shadowsEnabled = m_Asset.AreShadowsEnabled(); if (totalVisibleLights == 0 || m_Asset.MaxPixelLights == 0) { return(-1); } int brighestDirectionalIndex = -1; for (int i = 0; i < totalVisibleLights; ++i) { VisibleLight currLight = visibleLights[i]; // Particle system lights have the light property as null. We sort lights so all particles lights // come last. Therefore, if first light is particle light then all lights are particle lights. // In this case we either have no main light or already found it. if (currLight.light == null) { break; } // Shadow lights are sorted by type (directional > puctual) and intensity // The first shadow light we find in the list is the main light if (shadowsEnabled && currLight.light.shadows != LightShadows.None && LightweightUtils.IsSupportedShadowType(currLight.lightType)) { return(i); } // In case no shadow light is present we will return the brightest directional light if (currLight.lightType == UnityEngine.LightType.Directional && brighestDirectionalIndex == -1) { brighestDirectionalIndex = i; } } return(brighestDirectionalIndex); }
public FrameRenderingConfiguration SetupFrameRenderingConfiguration(CameraContext cameraContext, ShadowManager shadowManager) { var configuration = (cameraContext.StereoEnabled) ? FrameRenderingConfiguration.Stereo : FrameRenderingConfiguration.None; if (cameraContext.StereoEnabled && XRSettings.eyeTextureDesc.dimension == TextureDimension.Tex2DArray) { m_IntermediateTextureArray = true; } else { m_IntermediateTextureArray = false; } var camera = cameraContext.Camera; bool hdrEnabled = m_Asset.SupportsHDR && camera.allowHDR; bool intermediateTexture = camera.targetTexture != null || camera.cameraType == CameraType.SceneView || m_Asset.RenderScale < 1.0f || hdrEnabled; m_ColorFormat = hdrEnabled ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default; m_RequireCopyColor = false; m_DepthRenderBuffer = false; m_CameraPostProcessLayer = camera.GetComponent <PostProcessLayer>(); bool msaaEnabled = camera.allowMSAA && m_Asset.MSAASampleCount > 1 && (camera.targetTexture == null || camera.targetTexture.antiAliasing > 1); // TODO: PostProcessing and SoftParticles are currently not support for VR bool postProcessEnabled = m_CameraPostProcessLayer != null && m_CameraPostProcessLayer.enabled && !cameraContext.StereoEnabled; m_RequireDepthTexture = m_Asset.RequireDepthTexture && !cameraContext.StereoEnabled; if (postProcessEnabled) { m_RequireDepthTexture = true; intermediateTexture = true; configuration |= FrameRenderingConfiguration.PostProcess; if (m_CameraPostProcessLayer.HasOpaqueOnlyEffects(m_PostProcessRenderContext)) { configuration |= FrameRenderingConfiguration.BeforeTransparentPostProcess; if (m_CameraPostProcessLayer.sortedBundles[PostProcessEvent.BeforeTransparent].Count == 1) { m_RequireCopyColor = true; } } } if (cameraContext.SceneViewCamera) { m_RequireDepthTexture = true; } if (shadowManager.Shadows) { m_RequireDepthTexture = shadowManager.IsScreenSpace; if (!msaaEnabled) { intermediateTexture = true; } } if (msaaEnabled) { configuration |= FrameRenderingConfiguration.Msaa; intermediateTexture = intermediateTexture || !LightweightUtils.PlatformSupportsMSAABackBuffer(); } if (m_RequireDepthTexture) { // If msaa is enabled we don't use a depth renderbuffer as we might not have support to Texture2DMS to resolve depth. // Instead we use a depth prepass and whenever depth is needed we use the 1 sample depth from prepass. // Screen space shadows require depth before opaque shading. if (!msaaEnabled && !shadowManager.Shadows) { bool supportsDepthCopy = m_CopyTextureSupport != CopyTextureSupport.None && m_Asset.CopyDepthShader.isSupported; m_DepthRenderBuffer = true; intermediateTexture = true; // If requiring a camera depth texture we need separate depth as it reads/write to depth at same time // Post process doesn't need the copy if (!m_Asset.RequireDepthTexture && postProcessEnabled) { configuration |= (supportsDepthCopy) ? FrameRenderingConfiguration.DepthCopy : FrameRenderingConfiguration.DepthPrePass; } } else { configuration |= FrameRenderingConfiguration.DepthPrePass; } } Rect cameraRect = camera.rect; if (!(Math.Abs(cameraRect.x) > 0.0f || Math.Abs(cameraRect.y) > 0.0f || Math.Abs(cameraRect.width) < 1.0f || Math.Abs(cameraRect.height) < 1.0f)) { configuration |= FrameRenderingConfiguration.DefaultViewport; } else { intermediateTexture = true; } if (intermediateTexture) { configuration |= FrameRenderingConfiguration.IntermediateTexture; } return(configuration); }
void Render(ref ScriptableRenderContext context, CameraContext cameraContext) { /// /// culling /// if (!m_CullingUtil.Cull(ref context, cameraContext, m_ShadowManager.MaxShadowDistance)) { return; } var visibleLights = m_CullingUtil.CullResults.visibleLights; /// /// setup lights & shadows /// LightData lightData; m_LightManager.InitializeLightData(visibleLights, out lightData, cameraContext.Camera); m_ShadowManager.ShadowPass(visibleLights, ref context, ref lightData, m_CullingUtil.CullResults, m_LightManager.GetLightUnsortedIndex(lightData.mainLightIndex), cameraContext.Camera.backgroundColor); /// /// setup /// var frameRenderingConfiguration = m_TextureUtil.SetupFrameRenderingConfiguration(cameraContext, m_ShadowManager); m_TextureUtil.SetupIntermediateResources(frameRenderingConfiguration, ref context, cameraContext, m_ColorRT); // SetupCameraProperties does the following: // Setup Camera RenderTarget and Viewport // VR Camera Setup and SINGLE_PASS_STEREO props // Setup camera view, proj and their inv matrices. // Setup properties: _WorldSpaceCameraPos, _ProjectionParams, _ScreenParams, _ZBufferParams, unity_OrthoParams // Setup camera world clip planes props // setup HDR keyword // Setup global time properties (_Time, _SinTime, _CosTime) context.SetupCameraProperties(cameraContext.Camera, cameraContext.StereoEnabled); if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.DepthPrePass)) { DepthPass(ref context, frameRenderingConfiguration, m_CullingUtil.CullResults.visibleRenderers, cameraContext.Camera); } if (m_ShadowManager.Shadows) { m_ShadowManager.ShadowCollectPass(visibleLights, ref context, ref lightData, frameRenderingConfiguration, cameraContext.Camera); } else { m_ShadowManager.SmallShadowBuffer(ref context); } /// /// forward pass /// /// * Clear /// * Opaque /// * AfterOpaque /// * Transparent /// * AfterTransparent /// * PostEffect /// ForwardPass(visibleLights, frameRenderingConfiguration, ref context, ref lightData, cameraContext, m_CullingUtil.CullResults); }