WPF/E + 3D [来自Msdn forums]
2007-04-29 20:27
197 查看
WPF/E doesn't have built-in 3D functionality.
However, approximate 3D functionality can be obtained using some simple tricks. You may see the demonstration on http://www.windowsvista.si/main.htm?show3d=1&content=home (of course WPF/E should be already installed)
This site, which you all have probably seen, has an url tweak to show some 3D content. It is just a demo, but almost any simple 3D object can be displayed. As there is no frustum clipping (yet), the objects should be always in front of the camera. With frustum clipping (consequently it makes tesselation) 3D rooms are possible and even some kind of a 3D game.
If you wonder, how it is made, this is the technique:
- create an Image element with MatrixTransform and PolyLineSegment clipping geometry
- image width and height should both be 1 (actual size is defined later by transform matrix)
- polyline clipping geometry should be a triangle, which occupies the area, which will be used and displayed as a texture (3 polygon points represent 3 texture coordinates)
- 3D transformation by matrix and projective division should be made, as in every other 3D engine. Transformed vertices in 2D are used to align Image.
- matrix coefficients for Image MatrixTransform are computed by inverting tex-coord matrix and multiplying by 2D transformed vertices (numbers in parenthesis are matrix dimensions):
M(3x2) = V(3x2) * T(3x3)^(-1)
- all coefficients are multiplied by half the desired viewport size, and offset is increased to the half of the viewport size
- the image is then displayed by aligning each visual vertex into 2D transformed vertex.
All this tasks can be visible in javascript for 3D objects, http://www.windowsvista.si/js/object_3d.js
The cubic object is currently hard codec into the source code, but it can be any simple object. For now, I didn't use any lighting and coloring, but it may be done by using opacitymask.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1223869&SiteID=1
However, approximate 3D functionality can be obtained using some simple tricks. You may see the demonstration on http://www.windowsvista.si/main.htm?show3d=1&content=home (of course WPF/E should be already installed)
This site, which you all have probably seen, has an url tweak to show some 3D content. It is just a demo, but almost any simple 3D object can be displayed. As there is no frustum clipping (yet), the objects should be always in front of the camera. With frustum clipping (consequently it makes tesselation) 3D rooms are possible and even some kind of a 3D game.
If you wonder, how it is made, this is the technique:
- create an Image element with MatrixTransform and PolyLineSegment clipping geometry
- image width and height should both be 1 (actual size is defined later by transform matrix)
- polyline clipping geometry should be a triangle, which occupies the area, which will be used and displayed as a texture (3 polygon points represent 3 texture coordinates)
- 3D transformation by matrix and projective division should be made, as in every other 3D engine. Transformed vertices in 2D are used to align Image.
- matrix coefficients for Image MatrixTransform are computed by inverting tex-coord matrix and multiplying by 2D transformed vertices (numbers in parenthesis are matrix dimensions):
M(3x2) = V(3x2) * T(3x3)^(-1)
- all coefficients are multiplied by half the desired viewport size, and offset is increased to the half of the viewport size
- the image is then displayed by aligning each visual vertex into 2D transformed vertex.
All this tasks can be visible in javascript for 3D objects, http://www.windowsvista.si/js/object_3d.js
The cubic object is currently hard codec into the source code, but it can be any simple object. For now, I didn't use any lighting and coloring, but it may be done by using opacitymask.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1223869&SiteID=1
相关文章推荐
- WPF/E + 3D [来自Msdn forums]
- WPF/E + 3D [来自Msdn forums]
- wpf学习笔记-3D
- WPF 3D 平移模型+动画(桥梁检测系统)
- WPF 3D 学习资源
- wpf 3d笔记1
- 好玩的WPF第四弹:用Viewport2DVisual3D实现3D旋转效果
- WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体
- 最优化WPF 3D性能(基于“Tier-2”硬件)
- 使用WPF实现3D场景[二]
- Wpf 3D入门指南(Windows Presentation Foundation (WPF) 3D Tutorial)(二)
- 好玩的WPF第四弹:用Viewport2DVisual3D实现3D旋转效果
- WPF 3D:使用变换中的TranslateTransform3D
- WPF 3D:MeshGeometry3D的定义和光照
- WPF下的3d模型导出,从MeshGeometry3D 导出到 obj 文件
- Windows Presentation Foundation (WPF) 3D 教程(三) ----从下面的代码开始
- wpf之3d基础
- wpf动态加载obj格式的3D模型
- Rendering Transparent 3D Surfaces in WPF with C#(转载)
- WPF中实现图片文件转换成Visual对象,Viewport3D对象转换成图片