I use Viewport3D in my WPF application. I use VisualBrush for the Material of the Model3D.I want the appearance of the 3D model the same size as my actual window(which the VisualBrush is from), and I want to control the size of the appearance at runtime time according to my actual window.
I don't know how to transform the Camera(PerspectiveCamera), or the GeometryModel3D, or the Viewport to let the perspective on the ViewPort3D to be the same size as my actual window
And what is the relationship between the Viewport3D and the GeometryModel3D in it

Relationship between Viewport3D and GeometryModel3D?
builtbikes
Thank you very much,
Is the ViewPort3D is exactly what we see on the screen or there is another transfrom between ViewPort3D to Screen
I don't know what it meens indeed : (
pdaitguy
The relationship between the two is a series of transforms. Using these transforms, you can find out what four points in 3D map to the 2D corners of the window
Point3D * [ GM3D.Transform * (... parent Model3DGroup.Transforms ...) * (... parent ModelVisual3D.Transforms ...) * Camera.Transform^(-1) * Camera.ViewMatrix * Camera.ProjectionMatrix ] = Point
Let's call the combination of all the transforms in the [ ]'s "M." Make each of your 2D window corners into 3D points like (x, y, 0) and multiply it by M^(-1) and that should give you your four points in 3D.
Issues:
Vishalbhambure
Oh, wait, there's another 2D transform that happens at the end that I forgot about. Rather than have you duplicate that, just multiply the points:
by M^(-1).
If you're curious about the additional 2D transform I can explain it.