public AdornerSet3DContainer(Viewport3DElement adornedViewport) { if (adornedViewport == null) { throw new ArgumentNullException("adornedViewport"); } this.adornedViewport = adornedViewport; Rect computedTightBounds = adornedViewport.GetComputedTightBounds(); this.shadowAdorningContainer = new Viewport3DVisual(); this.shadowAdorningContainer.Children.Add((Visual3D)this.CreateContainerWorld()); this.shadowAdorningContainer.Viewport = computedTightBounds; this.orthographicAdorningContainer = new Viewport3DVisual(); this.orthographicAdorningContainer.Children.Add((Visual3D)this.CreateContainerWorld()); this.orthographicAdorningContainer.Viewport = computedTightBounds; ProjectionCamera projectionCamera1 = this.adornedViewport.Camera.ViewObject.PlatformSpecificObject as ProjectionCamera; ProjectionCamera projectionCamera2; if (projectionCamera1 != null) { projectionCamera2 = projectionCamera1.Clone(); projectionCamera2.Transform = Transform3D.Identity; } else { projectionCamera2 = (ProjectionCamera) new PerspectiveCamera(new Point3D(0.0, 0.0, 10.0), new Vector3D(0.0, 0.0, 1.0), new Vector3D(0.0, 1.0, 0.0), 35.0); } this.shadowAdorningContainer.Camera = (Camera)projectionCamera2; OrthographicCamera orthographicCamera = new OrthographicCamera(projectionCamera2.Position, projectionCamera2.LookDirection, projectionCamera2.UpDirection, 3.0); orthographicCamera.NearPlaneDistance = 0.01; orthographicCamera.FarPlaneDistance = 1000000.0; this.orthographicAdorningContainer.Camera = (Camera)orthographicCamera; this.Children.Add((Visual)this.shadowAdorningContainer); this.Children.Add((Visual)this.orthographicAdorningContainer); }