protected override void Execute(CustomPassContext ctx) { // Top right CustomPassUtils.Copy( ctx, ctx.cameraColorBuffer, ctx.customColorBuffer.Value, new Vector4(0.5f, 0.5f, 0.5f, 0.5f), new Vector4(0.5f, 0.5f, 0, 0), 0, 0 ); CustomPassUtils.Copy( ctx, ctx.customColorBuffer.Value, ctx.cameraColorBuffer, new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.75f, 0.75f), 0, 0 ); // Bottom left CustomPassUtils.Copy( ctx, ctx.cameraColorBuffer, halfResTarget, new Vector4(0.5f, 0.5f, 0.0f, 0.5f), new Vector4(0.5f, 0.5f, 0, 0), 0, 0 ); CustomPassUtils.Copy( ctx, halfResTarget, ctx.cameraColorBuffer, new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.5f, 0.5f), 0, 0 ); // Bottom right CustomPassUtils.Copy( ctx, ctx.cameraColorBuffer, ctx.customColorBuffer.Value, new Vector4(0.5f, 0.5f, 0.0f, 0.0f), new Vector4(0.5f, 0.5f, 0, 0), 0, 0 ); CustomPassUtils.Copy( ctx, ctx.customColorBuffer.Value, ctx.cameraColorBuffer, new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.75f, 0.5f), 0, 0 ); // top left CustomPassUtils.Copy( ctx, ctx.cameraColorBuffer, halfResTarget, new Vector4(0.5f, 0.5f, 0.5f, 0.0f), new Vector4(0.5f, 0.5f, 0, 0), 0, 1 ); CustomPassUtils.Copy( ctx, halfResTarget, ctx.cameraColorBuffer, new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.5f, 0.75f), 1, 0 ); }
protected override void Execute(CustomPassContext ctx) { CoreUtils.SetRenderTarget(ctx.cmd, temp, ClearFlag.Color); RenderStateBlock overrideDepth = new RenderStateBlock(RenderStateMask.Depth) { depthState = new DepthState(true, CompareFunction.LessEqual) }; using (new CustomPassUtils.DisableSinglePassRendering(ctx)) { using (new CustomPassUtils.OverrideCameraRendering(ctx, override1)) { CustomPassUtils.DrawRenderers(ctx, overrideMask1a, overrideRenderState: overrideDepth); using (new CustomPassUtils.OverrideCameraRendering(ctx, override2)) { CustomPassUtils.DrawRenderers(ctx, overrideMask2); } CustomPassUtils.DrawRenderers(ctx, overrideMask1b); } } CustomPassUtils.Copy(ctx, temp, ctx.cameraColorBuffer, CustomPassUtils.fullScreenScaleBias, new Vector4(0.5f, 0.5f, 0.0f, 0.0f)); }
protected override void Execute(CustomPassContext ctx) { if (customCamera0 == null || customCamera1 == null || customCamera2 == null || customCamera3 == null || customCamera4 == null) { return; } // Render from camera 0 // Internal API, can't be tested right now // using (new HDRenderPipeline.OverrideCameraRendering(ctx.cmd, customCamera0)) // { // CoreUtils.SetRenderTarget(ctx.cmd, temp, ClearFlag.Color); // CustomPassUtils.DrawRenderers(ctx, -1); // } // CustomPassUtils.Copy( // ctx, temp, ctx.cameraColorBuffer, // CustomPassUtils.fullScreenScaleBias, // new Vector4(.5f, .5f, 0f, 0f) // ); RenderStateBlock overrideDepth = new RenderStateBlock(RenderStateMask.Depth) { depthState = new DepthState(true, CompareFunction.LessEqual) }; // Render from camera 1 CustomPassUtils.RenderFromCamera(ctx, customCamera1, temp, ctx.customDepthBuffer.Value, ClearFlag.All, -1, overrideRenderState: overrideDepth); CustomPassUtils.Copy( ctx, temp, ctx.cameraColorBuffer, CustomPassUtils.fullScreenScaleBias, new Vector4(.5f, .5f, .5f, 0f) ); // Render from camera 4 (at same position than the test camera but uses a different FoV) // And with the camera depth buffer (which already contains opaque objects) CustomPassUtils.RenderFromCamera(ctx, customCamera4, ctx.cameraColorBuffer, ctx.cameraDepthBuffer, ClearFlag.None, customCamera4.cullingMask, overrideRenderState: overrideDepth); // Render from camera 3 using different buffers CustomPassUtils.RenderDepthFromCamera(ctx, customCamera3, temp, ctx.customDepthBuffer.Value, ClearFlag.All, -1); CustomPassUtils.Copy( ctx, temp, ctx.cameraColorBuffer, CustomPassUtils.fullScreenScaleBias, new Vector4(.25f, .25f, .5f, .5f) ); CustomPassUtils.RenderNormalFromCamera(ctx, customCamera3, temp, ctx.customDepthBuffer.Value, ClearFlag.All, -1); CustomPassUtils.Copy( ctx, temp, ctx.cameraColorBuffer, CustomPassUtils.fullScreenScaleBias, new Vector4(.25f, .25f, .75f, .5f) ); CustomPassUtils.RenderTangentFromCamera(ctx, customCamera3, temp, ctx.customDepthBuffer.Value, ClearFlag.All, -1); CustomPassUtils.Copy( ctx, temp, ctx.cameraColorBuffer, CustomPassUtils.fullScreenScaleBias, new Vector4(.25f, .25f, .5f, .75f) ); // Render from camera 2 in an half res buffer CustomPassUtils.RenderFromCamera(ctx, customCamera2, halfResColor, halfResDepth, ClearFlag.All, -1, overrideRenderState: overrideDepth); CustomPassUtils.Copy( ctx, halfResColor, ctx.cameraColorBuffer, CustomPassUtils.fullScreenScaleBias, new Vector4(.25f, .25f, .75f, .75f) ); }