public double CalcProjectionCoverage(MPPMotionData coverProjection) { var leftCoverage = calcProjectionCoverage(orientation, leftProjection, coverProjection.orientation, coverProjection.leftProjection); var rightCoverage = calcProjectionCoverage(orientation, rightProjection, coverProjection.orientation, coverProjection.rightProjection); return((leftCoverage + rightCoverage) / 2); }
public void Apply(MPPMotionData motionFrame, MPPMotionData motionHead, Vector2 encodingProjSize) { _leftEyeAnchor.localPosition = motionFrame.leftEyePos; _rightEyeAnchor.localPosition = motionFrame.rightEyePos; _leftEyeAnchor.localRotation = _rightEyeAnchor.localRotation = motionFrame.orientation; _leftEyeCamera.projectionMatrix = motionFrame.leftProjection.GetMatrix(_leftEyeCamera.nearClipPlane, _leftEyeCamera.farClipPlane); _rightEyeCamera.projectionMatrix = motionFrame.rightProjection.GetMatrix(_rightEyeCamera.nearClipPlane, _rightEyeCamera.farClipPlane); _leftEyeCamera.rect = new Rect(0.5f - motionFrame.leftProjection.width / encodingProjSize.x / 2, 0.5f - motionFrame.leftProjection.height / encodingProjSize.y / 2, motionFrame.leftProjection.width / encodingProjSize.x, motionFrame.leftProjection.height / encodingProjSize.y);; _rightEyeCamera.rect = new Rect(0.5f - motionFrame.rightProjection.width / encodingProjSize.x / 2, 0.5f - motionFrame.rightProjection.height / encodingProjSize.y / 2, motionFrame.rightProjection.width / encodingProjSize.x, motionFrame.rightProjection.height / encodingProjSize.y);; _leftEyeCamera.targetTexture.Release(); _rightEyeCamera.targetTexture.Release(); _foveationPatternInnerRadius = motionFrame.foveationInnerRadius; _foveationPatternMiddleRadius = motionFrame.foveationMiddleRadius; _foveationPatternScale = 1 / (motionFrame.leftProjection.aspect >= 1.0f ? motionFrame.leftProjection.height : motionFrame.leftProjection.width); _leftGazeLocation.x = -motionFrame.leftProjection.center.x / motionFrame.leftProjection.width; _leftGazeLocation.y = -motionFrame.leftProjection.center.y / motionFrame.leftProjection.height; _rightGazeLocation.x = -motionFrame.rightProjection.center.x / motionFrame.rightProjection.width; _rightGazeLocation.y = -motionFrame.rightProjection.center.y / motionFrame.rightProjection.height; }
public void AddPoint(MPPMotionData motionHead, MPPMotionData motionFrame) { var ideal = motionHead.leftProjection.width * motionHead.leftProjection.height; var overfillOnly = motionFrame.leftProjection.width * motionFrame.leftProjection.height; var innerArea = calcRadiiArea(motionFrame.leftProjection, motionFrame.foveationInnerRadius); var middleArea = calcRadiiArea(motionFrame.leftProjection, motionFrame.foveationMiddleRadius); var foveatedOverfill = innerArea + (middleArea - innerArea) / 4 + (overfillOnly - middleArea) / 16; var point = new Metrics { ideal = ideal, overfillOnly = overfillOnly, foveatedOverfill = foveatedOverfill }; _points.Add(point); if (_points.Count > length) { _points.RemoveAt(0); } if (autoFitRange) { var range = new Vector2(Mathf.Min(point.ratioOfOverfillOnlyToIdeal, point.ratioOfFoveatedOverfillToIdeal), Mathf.Max(point.ratioOfOverfillOnlyToIdeal, point.ratioOfFoveatedOverfillToIdeal)); _range = new Vector2(Mathf.Min(range.x, _range.x), Mathf.Max(range.y, _range.y)); } }
public void Apply(MPPMotionData motionFrame, MPPMotionData motionHead, bool useTimewarp, Vector2 encodingProjSize) { _leftCamera.previewAnchor.localRotation = _rightCamera.previewAnchor.localRotation = useTimewarp ? motionHead.orientation : motionFrame.orientation; _leftCamera.sceneTextureAnchor.localRotation = _rightCamera.sceneTextureAnchor.localRotation = motionFrame.orientation; var leftProjectionMatrix = motionHead.leftProjection.GetMatrix(_leftCamera.preview.nearClipPlane, _leftCamera.preview.farClipPlane); var rightProjectionMatrix = motionHead.rightProjection.GetMatrix(_rightCamera.preview.nearClipPlane, _rightCamera.preview.farClipPlane); var leftViewportWidth = 0.5f * motionHead.leftProjection.aspect; _leftCamera.preview.projectionMatrix = motionHead.leftProjection.GetMatrix(_leftCamera.preview.nearClipPlane, _leftCamera.preview.farClipPlane, _owner.settings.PreviewRenderScale); _leftCamera.preview.rect = new Rect(0.5f - leftViewportWidth, 1 - _displayAspect / 2, leftViewportWidth, 1); var rightViewportWidth = 0.5f * motionHead.rightProjection.aspect; _rightCamera.preview.projectionMatrix = motionHead.rightProjection.GetMatrix(_rightCamera.preview.nearClipPlane, _rightCamera.preview.farClipPlane, _owner.settings.PreviewRenderScale); _rightCamera.preview.rect = new Rect(0.5f, 1 - _displayAspect / 2, rightViewportWidth, 1); _leftCamera.capture.projectionMatrix = leftProjectionMatrix; _rightCamera.capture.projectionMatrix = rightProjectionMatrix; _leftCamera.SetProjection(motionHead.leftProjection, motionFrame.leftProjection); _leftCamera.sceneTexture.localPosition = new Vector3(motionFrame.leftProjection.center.x, motionFrame.leftProjection.center.y, 1.0f); _leftCamera.sceneTexture.localScale = new Vector3(encodingProjSize.x, encodingProjSize.y, 1); _rightCamera.sceneTexture.localPosition = new Vector3(motionFrame.rightProjection.center.x, motionFrame.rightProjection.center.y, 1.0f); _rightCamera.sceneTexture.localScale = new Vector3(encodingProjSize.x, encodingProjSize.y, 1); var mat = _leftCamera.sceneTextureRenderer.material; if (mat.HasProperty("_Bound")) { mat.SetFloat("_Opacity", _owner.settings.VisualizeRenderingInfo && _owner.settings.UseFoveatedRendering ? 1.0f : 0.0f); mat.SetFloat("_InnerRadii", motionFrame.foveationInnerRadius); mat.SetFloat("_MidRadii", motionFrame.foveationMiddleRadius); mat.SetFloat("_GazeX", -motionFrame.leftProjection.center.x); mat.SetFloat("_GazeY", -motionFrame.leftProjection.center.y); mat.SetVector("_Bound", new Vector4(-motionFrame.leftProjection.width / 2, motionFrame.leftProjection.height / 2, motionFrame.leftProjection.width / 2, -motionFrame.leftProjection.height / 2)); } }
public abstract bool GetCurrentMotion(bool predictive, AirXRServerSettings.OverfillMode overfillingMode, ref MPPMotionData motionFrame, ref MPPMotionData motionHead, ref (int frame, int head) cursor);