Flash 360 degree 3D virtual Reality (CUBICVR) Implementation principle
Flash 3D Virtual reality originated from the German Flash graphics, Daniel Andre.michelle published an article on virtual reality in his labsite:lab.andre-michelle.com, and provided an example of NaN SourceCode). In order to penetrate virtual reality, in the next 2 months I have found some cubicvr source files and try to decipher some source code, I also tried to develop a simple flash3d engine and picture 3D stretching algorithm, all of these ideas from Andre-michelle in its log Some ideas that are mentioned in. The example used in this article is still my collation of the earlier version of Andre, although the new version I developed now has better structure and execution efficiency, but this version of the programming idea is more understandable. I want to use this vacation time to develop the Flash ball type virtual reality, make it more real.
The deployment of 3D virtual reality in Flash is no doubt a revolutionary step, and we don't have to install Java virtual machines and QTVR anymore, in fact, virtual realities developed on the basis of a programmable vector graphics interface based on Flash can achieve the perfect user experience through innovative user interfaces. City8.com uses this technique to deploy their panoramic experience of the city map.
Demo: Mouse Drag and drop to convert camera perspective
Principle:
Point perspective and projection
By 1 point perspective to produce far small near-large changes to create a sense of space, in CUBICVR, imagine the observer camera in a positive hexahedral center, through a point of perspective to calculate the position of each plane in the space projection, to produce perspective.
Demo: No introduction to Perspective equation:
Subdivision map
The Matrix class of Flash supports only 2D graphics transformations: Shear, scaling, plane displacement. The bitmap does not implement the 3D transform, unlike OpenGL, OpenGL only needs to define the multilateral vertex and texture normals, the bitmap will be automatically affixed to a patch, and the entire texturing process is complete by the GPU. In Flash, we must use the method of subdivision mapping to deceive people's eyes, both: A picture subdivision into N small triangular surface, and then the small triangular surface shear plane, because of this, flash3d once involved in the map will inevitably lead to a large number of CPU computing resources.
Demo of Subdivision map:
Http://godson.blueidea.com/archives/2006/3708.shtml
Hidden algorithm
If there is no hidden algorithm, then the observer can only see the closest face to the screen, and can not see the entire 3D space, theoretically hidden algorithm has 3 steps: 1 in a six-face, the angle between the surface normal and the view cone is greater than 180 degrees should be set to invisible, 2 on the same pixel, Show only the nearest polygon (ZBuffer algorithm) with camera, 3 projection is not visible outside the screen, but these three algorithms are very CPU-intensive, Andrew designed a simpler algorithm: 1 polygons overlap The center of the camera, in the camera coordinate system, Z-value The <0 polygon is not visible, and the 2 projection is not visible in the multilateral form outside the screen.