Ejemplo n.º 1
0
        protected void RenderCamera()
        {
            var cmd = CommandBufferPool.Get();
            var hd  = HDCamera.GetOrCreate(SensorCamera);

            if (renderTarget.IsCube && !HDAdditionalCameraData.hasCustomRender)
            {
                // HDRP renders cubemap as multiple separate images, each with different exposure.
                // Locking exposure will force it to use the same value for all faces, removing inconsistencies.
                hd.LockExposure();
                SensorCamera.stereoSeparation = 0f;
                SensorCamera.RenderToCubemap(renderTarget, faceMask, Camera.MonoOrStereoscopicEye.Left);
                hd.UnlockExposure();
            }
            else
            {
                SensorCamera.Render();
            }

            if (Distorted)
            {
                if (Fisheye)
                {
                    LensDistortion.UnifiedProjectionDistort(cmd, renderTarget, DistortedHandle);
                }
                else
                {
                    LensDistortion.PlumbBobDistort(cmd, renderTarget, DistortedHandle);
                }

                cmd.SetGlobalVector(ScreenSizeProperty, new Vector4(Width, Height, 1.0f / Width, 1.0f / Height));
                var ctx = new PostProcessPassContext(cmd, hd, DistortedHandle);
                SimulatorManager.Instance.Sensors.PostProcessSystem.RenderLateForSensor(ctx, this);
            }

            FinalRenderTarget.BlitTo2D(cmd, hd);
            HDRPUtilities.ExecuteAndClearCommandBuffer(cmd);
            CommandBufferPool.Release(cmd);
        }