Пример #1
0
        public override void TickLogic(CGfxSceneView view, CRenderContext rc)
        {
            if (BaseSceneView == null)
            {
                return;
            }

            Camera.PushVisibleSceneMesh2RenderLayer();

            //int CurrDPNumber = 0;
            //opaque render pass;
            BaseSceneView.CookSpecRenderLayerDataToPass(rc, ERenderLayer.RL_Opaque, Camera, mSnapshotSE, PrebuildPassIndex.PPI_Snapshot);
            //custom opaque render pass;
            BaseSceneView.CookSpecRenderLayerDataToPass(rc, ERenderLayer.RL_CustomOpaque, Camera, mSnapshotSE, PrebuildPassIndex.PPI_Snapshot);
            //sky render pass;
            BaseSceneView.CookSpecRenderLayerDataToPass(rc, ERenderLayer.RL_Sky, Camera, mSnapshotSE, PrebuildPassIndex.PPI_Snapshot);
            //custom translucent render pass;
            BaseSceneView.CookSpecRenderLayerDataToPass(rc, ERenderLayer.RL_CustomTranslucent, Camera, mSnapshotSE, PrebuildPassIndex.PPI_Snapshot);
            //translucent render pass;
            BaseSceneView.CookSpecRenderLayerDataToPass(rc, ERenderLayer.RL_Translucent, Camera, mSnapshotSE, PrebuildPassIndex.PPI_Snapshot);
            //gizmos render pass;
            BaseSceneView.CookSpecRenderLayerDataToPass(rc, ERenderLayer.RL_Gizmos, Camera, mSnapshotSE, PrebuildPassIndex.PPI_Snapshot);

            var CmdList = mCLDB_Snapshot[0];

            BaseSceneView.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Opaque);
            BaseSceneView.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_CustomOpaque);
            BaseSceneView.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Sky);
            BaseSceneView.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_CustomTranslucent);
            BaseSceneView.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Translucent);
            BaseSceneView.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Gizmos);

            CmdList.BeginCommand();
            CmdList.BeginRenderPass(mRenderPassDesc_Snapshot, BaseSceneView.FrameBuffer);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            if (OnAfterTickLogic != null)
            {
                OnAfterTickLogic(view, rc, CmdList, OnAfterTickLogicArgument);
            }

            CmdList.EndCommand();

            CmdList = mCLDB_Copy[0];
            if (mScreenAlignedTriangle != null)
            {
                mFinalView.CookViewportMeshToPass(rc, mCopySE, Camera, mScreenAlignedTriangle);
                mFinalView.PushPassToRHI(CmdList);
                this.RiseOnDrawUI(CmdList, mFinalView);
            }

            //CmdList.BeginCommand();
            //CmdList.BeginRenderPass(mRenderPassDesc_Final, mFinalView.FrameBuffer);
            //LatestPass = CmdList.BuildRenderPass(int.MaxValue, GraphicsDebug);
            //CmdList.EndRenderPass();
            //CmdList.EndCommand();
        }
Пример #2
0
        public void TickLogic()
        {
            if (mSV_PickedSetUp == null)
            {
                return;
            }

            ScopeTickLogic.Begin();

            mSV_PickedSetUp.CookSpecRenderLayerDataToPass(mRHICtx, ERenderLayer.RL_Opaque, mCamera, mSE_PickedSetUp, PrebuildPassIndex.PPI_PickedEditor);
            mSV_PickedSetUp.CookSpecRenderLayerDataToPass(mRHICtx, ERenderLayer.RL_CustomOpaque, mCamera, mSE_PickedSetUp, PrebuildPassIndex.PPI_PickedEditor);
            mSV_PickedSetUp.CookSpecRenderLayerDataToPass(mRHICtx, ERenderLayer.RL_CustomTranslucent, mCamera, mSE_PickedSetUp, PrebuildPassIndex.PPI_PickedEditor);
            mSV_PickedSetUp.CookSpecRenderLayerDataToPass(mRHICtx, ERenderLayer.RL_Translucent, mCamera, mSE_PickedSetUp, PrebuildPassIndex.PPI_PickedEditor);
            mSV_PickedSetUp.CookSpecRenderLayerDataToPass(mRHICtx, ERenderLayer.RL_Gizmos, mCamera, mSE_PickedSetUp, PrebuildPassIndex.PPI_PickedEditor);

            var CmdList = mCLDB_Picked[0];

            mSV_PickedSetUp.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Opaque);
            mSV_PickedSetUp.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_CustomOpaque);
            mSV_PickedSetUp.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_CustomTranslucent);
            mSV_PickedSetUp.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Translucent);
            mSV_PickedSetUp.PushSpecRenderLayerDataToRHI(CmdList, ERenderLayer.RL_Gizmos);

            CmdList.BeginCommand();
            CmdList.BeginRenderPass(mRenderPassDesc_Picked, mSV_PickedSetUp.FrameBuffer);
            CmdList.BuildRenderPass(mDPLimitter);
            CmdList.EndRenderPass();

            mSV_PickedBlurH.CookViewportMeshToPassInMultiPassMode(mRHICtx, mSE_PickedBlurH, 0, mCamera, mScreenAlignedTriangle);
            mSV_PickedBlurH.PushPassToRHIInMultiPassMode(CmdList, 0);
            CmdList.BeginRenderPass(mRenderPassDesc_Picked, mSV_PickedBlurH.FrameBuffer);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            mSV_PickedBlurV.CookViewportMeshToPass(mRHICtx, mSE_PickedBlurV, mCamera, mScreenAlignedTriangle);
            mSV_PickedBlurV.PushPassToRHI(CmdList);
            CmdList.BeginRenderPass(mRenderPassDesc_Picked, mSV_PickedBlurV.FrameBuffer);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();
            CmdList.EndCommand();

            CmdList = mCLDB_DisableWarning[0];
            mSV_PickedBlurH.CookViewportMeshToPassInMultiPassMode(mRHICtx, mSE_PickedHollow, 1, mCamera, mScreenAlignedTriangle);
            mSV_PickedBlurH.PushPassToRHIInMultiPassMode(CmdList, 1);
            CmdList.BeginCommand();
            CmdList.BeginRenderPass(mRenderPassDesc_Picked, mSV_PickedBlurH.FrameBuffer);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();
            CmdList.EndCommand();

            ScopeTickLogic.End();
        }
Пример #3
0
        public void TickLogic(CRenderContext RHICtx, CGfxCamera camera)
        {
            if (CEngine.EnableBloom == false)
            {
                return;
            }
            if (RHICtx == null)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "@Graphic", $"BloomError!!!", "");
                return;
            }

            ScopeTickLogic.Begin();
            //blur h pass
            var CmdList = mCmdListDB_Bloom[0];

            CmdList.BeginCommand();
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mView_BlurH8.FrameBuffer);
            mView_BlurH8.CookViewportMeshToPass(RHICtx, mSE_BlurH, camera, mScreenAlignedTriangle);
            mView_BlurH8.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //blur v pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mView_BlurV8.FrameBuffer);
            mView_BlurV8.CookViewportMeshToPass(RHICtx, mSE_BlurV, camera, mScreenAlignedTriangle);
            mView_BlurV8.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //d16 pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mDSView16.FrameBuffer);
            mDownSampSE.mSrcTex = mView_BlurV8.FrameBuffer.GetSRV_RenderTarget(0);
            mDSView16.CookViewportMeshToPass(RHICtx, mDownSampSE, camera, mScreenAlignedTriangle);
            mDSView16.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //d32 pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mDSView32.FrameBuffer);
            mDownSampSE.mSrcTex = mDSView16.FrameBuffer.GetSRV_RenderTarget(0);
            mDSView32.CookViewportMeshToPass(RHICtx, mDownSampSE, camera, mScreenAlignedTriangle);
            mDSView32.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //d64 pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mDSView64.FrameBuffer);
            mDownSampSE.mSrcTex = mDSView32.FrameBuffer.GetSRV_RenderTarget(0);
            mDSView64.CookViewportMeshToPass(RHICtx, mDownSampSE, camera, mScreenAlignedTriangle);
            mDSView64.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //u32 pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mUSView32.FrameBuffer);
            mUpSampSE.mSrcTexUp   = mDSView32.FrameBuffer.GetSRV_RenderTarget(0);
            mUpSampSE.mSrcTexDown = mDSView64.FrameBuffer.GetSRV_RenderTarget(0);
            mUSView32.CookViewportMeshToPass(RHICtx, mUpSampSE, camera, mScreenAlignedTriangle);
            mUSView32.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //u16 pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mUSView16.FrameBuffer);
            mUpSampSE.mSrcTexUp   = mDSView16.FrameBuffer.GetSRV_RenderTarget(0);
            mUpSampSE.mSrcTexDown = mUSView32.FrameBuffer.GetSRV_RenderTarget(0);
            mUSView16.CookViewportMeshToPass(RHICtx, mUpSampSE, camera, mScreenAlignedTriangle);
            mUSView16.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();

            //u8 pass
            CmdList.BeginRenderPass(mRenderPassDesc_Bloom, mUSView8.FrameBuffer);
            mUpSampSE.mSrcTexUp   = mView_BlurV8.FrameBuffer.GetSRV_RenderTarget(0);
            mUpSampSE.mSrcTexDown = mUSView16.FrameBuffer.GetSRV_RenderTarget(0);
            mUSView8.CookViewportMeshToPass(RHICtx, mUpSampSE, camera, mScreenAlignedTriangle);
            mUSView8.PushPassToRHI(CmdList);
            CmdList.BuildRenderPass();
            CmdList.EndRenderPass();
            CmdList.EndCommand();

            ScopeTickLogic.End();
        }
Пример #4
0
        public void TickLogic(CRenderContext RHICtx, CGfxCamera camera, CGfxSceneView BaseSceneView)
        {
            if (RHICtx == null)
            {
                System.Diagnostics.Debug.Assert(false);
                return;
            }

            if (CEngine.EnableMobileAo == true)
            {
                mAoParam.X = mRadius;
                mAoParam.Z = mBias;
                //float temp0 = 1.0f / (mRadius * mRadius * mRadius);
                //mDarkness = temp0 * temp0 * mDarkness;
                mAoParam.W = mDarkness;

                if (CEngine.Instance.RenderSystem.RHIType != ERHIType.RHT_OGL)
                {
                    mAoParam.Y = 1.0f;
                }
                else
                {
                    mAoParam.Y = -1.0f;
                }

                //ao mask pass
                var CmdList = mCLDB_AoMask[0];
                CmdList.BeginCommand();
                mSE_AoMask.mBaseSceneView = BaseSceneView.FrameBuffer.GetSRV_RenderTarget(0);
                mView_AoMask.AoParam      = mAoParam;
                mView_AoMask.CookViewportMeshToPassInMultiPassMode(RHICtx, mSE_AoMask, 0, camera, mScreenAlignedTriangle);
                mView_AoMask.PushPassToRHIInMultiPassMode(CmdList, 0);
                CmdList.BeginRenderPass(mRenderPassDesc_Ao, mView_AoMask.FrameBuffer);
                CmdList.BuildRenderPass();
                CmdList.EndRenderPass();
                CmdList.EndCommand();

                //ao blur h;
                CmdList = mCLDB_BlurH[0];
                CmdList.BeginCommand();
                //mSE_BlurH.mSRV_AoMask = mView_AoMask.FrameBuffer.GetSRV_RenderTarget(0);
                mView_BlurH.CookViewportMeshToPass(RHICtx, mSE_BlurH, camera, mScreenAlignedTriangle);
                mView_BlurH.PushPassToRHI(CmdList);
                CmdList.BeginRenderPass(mRenderPassDesc_Ao, mView_BlurH.FrameBuffer);
                CmdList.BuildRenderPass();
                CmdList.EndRenderPass();
                CmdList.EndCommand();

                //ao blur v;
                CmdList = mCLDB_BlurV[0];
                CmdList.BeginCommand();
                mSE_BlurV.mSRV_Src = mView_BlurH.FrameBuffer.GetSRV_RenderTarget(0);
                mView_AoMask.CookViewportMeshToPassInMultiPassMode(RHICtx, mSE_BlurV, 1, camera, mScreenAlignedTriangle);
                mView_AoMask.PushPassToRHIInMultiPassMode(CmdList, 1);
                CmdList.BeginRenderPass(mRenderPassDesc_Ao, mView_AoMask.FrameBuffer);
                CmdList.BuildRenderPass();
                CmdList.EndRenderPass();
                CmdList.EndCommand();

                //CmdList = mCLDB_BlurV[0];
                //CmdList.BeginCommand();
                //mView_BlurV.CookViewportMeshToPass(RHICtx, mSE_BlurV, camera, mScreenAlignedTriangle);
                //mView_BlurV.PushPassToRHI(CmdList);
                //CmdList.BeginRenderPass(mRenderPassDesc_Ao, mView_BlurV.FrameBuffer);
                //CmdList.BuildRenderPass(ref DPLimitter);
                //CmdList.EndRenderPass();
                //CmdList.EndCommand();
            }
            else
            {
                //ao blur v;
                var CmdList = mCLDB_BlurV[0];
                CmdList.BeginCommand();
                CmdList.BeginRenderPass(mRenderPassDesc_Ao, mView_AoMask.FrameBuffer);
                CmdList.EndRenderPass();
                CmdList.EndCommand();
                //var CmdList = mCLDB_BlurV[0];
                //CmdList.BeginCommand();
                //CmdList.BeginRenderPass(mRenderPassDesc_Ao, mView_BlurV.FrameBuffer);
                //CmdList.EndRenderPass();
                //CmdList.EndCommand();
            }
        }