Beispiel #1
0
 protected void RenderCamera()
 {
     if (!Distorted || !Fisheye)
     {
         SensorCamera.Render();
         if (Distorted)
         {
             LensDistortion.PlumbBobDistort(renderTarget, DistortedTexture);
         }
     }
     else
     {
         RenderToCubemap();
         LensDistortion.UnifiedProjectionDistort(renderTarget ?? CubemapTexture, DistortedTexture);
     }
 }
        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));
                SimulatorManager.Instance.Sensors.PostProcessSystem.RenderLateForSensor(cmd, hd, this, DistortedHandle.ColorHandle);
            }

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