Exemple #1
0
 public DepthTextureMode RenderDepthOnlyWhenOpaque(Camera camera, OceanCameraTask data, DepthEffecttProjectSettings setting, PreparedContent renderContents)
 {
     RemoveCommandBufferColor(camera);
     OceanIsOpaque();
     InternalRenderDepthOnly(camera, data, setting, renderContents);
     SetValuesToShader();
     return(DepthTextureMode.None);
 }
Exemple #2
0
            internal void InternalRenderColorAndDepth(Camera camera, OceanCameraTask oceanCamera, DepthEffecttProjectSettings setting, PreparedContent renderContents)
            {
                var textureSize        = RenderHelper.GetTextureSize(camera, setting.TextureScale);
                var colorRenderTexture = RenderTexture.GetTemporary(textureSize.x, textureSize.y);
                var depthRenderTexture = RenderTexture.GetTemporary(textureSize.x, textureSize.y, 24, RenderTextureFormat.Depth);

                renderCamera.clearFlags    = CameraClearFlags.Skybox;
                renderCamera.renderingPath = setting.CameraRenderingPath;
                RenderHelper.CopyCameraOptions(camera, renderCamera);
                RenderHelper.SetLayerWithoutWater(renderCamera, setting.CullingMask & camera.cullingMask);
                RenderHelper.CopySkyBox(oceanCamera, skybox);
                renderCamera.transform.position = camera.transform.position;
                renderCamera.transform.rotation = camera.transform.rotation;

                using (new RenderHelper.PointLightsScope(setting.EnablePointLights))
                {
                    oceanCamera.TaskController.OnPreRefractionRender(oceanCamera);
                    renderCamera.SetTargetBuffers(colorRenderTexture.colorBuffer, depthRenderTexture.depthBuffer);
                    renderCamera.Render();
                    renderCamera.targetTexture = null;
                    oceanCamera.TaskController.OnPostRefractionRender(oceanCamera);
                }

                RefractionTexture      = colorRenderTexture;
                RefractionDepthTexture = depthRenderTexture;
            }