Now the VR seems not so hot before, so I actually started the VR journey ...
Speaking of VR, for those who have not received the relevant knowledge may seem relatively tall, but the principle of VR is not as complex as imagined. In general, VR can produce three-dimensional sense because people have two eyes. In fact, there are many self-proclaimed VR video or pictures strictly speaking is not a VR, because it is just a plan to become a 360° map, in fact, and the plan is the same, and no depth information, but you can turn small head to all aspects of observation. Such as:
Can see the picture is distorted, as to why the human eye in the VR glasses to see the image is normal, because this picture is not directly seen, it needs to project the entire image into a sphere of the inner surface (you can imagine the globe to expand into a plan and to replenish the cracked part), Then the camera is in the center of the inside of the sphere, this time from the VR glasses is just a small part of the ball, of course, you can turn your small head to observe all-round, when the rotation of the gyroscope reading to calculate the camera's rotation angle. This kind of VR principle is probably so, is not feel very simple!
Real depth Information VR picture/video actually has two parts, in which more is left and right screen and up and down screen, this time it can not be projected directly onto a ball, but projected to two balls, and need to have two cameras to provide the left eye and the eye image, At this time the left eye and the right eye to see the image is not exactly the same, there is a certain dislocation, with our eyes open to see the world, so at this time the image is three-dimensional, with depth information. Such as:
(Image comparison Slag, will be seen)
The top and bottom look similar, but in fact there is a difference, the projection will be the upper part of the projection to the left eye, the lower part of the projection to the right eye, how the implementation will be said in the back. In addition to the top and bottom split screen in fact there are left and right split screen, the principle is almost.
That's pretty much what it says. Development below:
First you have to prepare the development environment: unity#d5.6 (latest), Android SDK (5.1 +), Jdk,visualstudio 2017 (optional), Andoridstudio (optional). Unity Plugin: EasyMovieTexture3.59 (commercial buy, personal hobbies can go to search other people's share).
First look at the ordinary Panorama (no split screen), here forced to assume that you have set up all the environment, open Unity3d, create a new 3D Project, this time you will get a miancamera and a parallel light, the parallel light is deleted (like can also be kept). Create a new sphere, then import a panorama, drag the picture onto the sphere you just created, see that the sphere is now surrounded by your picture, and then set the ball's Scale property xyz to 5,5,-5 (other scales are OK, but make sure it's bigger than the camera). As for why the z-axis is-5, so will be talked about. Set the camera and the position of the ball to 0,0,0. When you click on the camera, you will not see anything in the preview window because your picture is affixed to the outer surface. Need to find a way to paste the picture to the inside surface, thank chaokui old iron to provide sharder.
Shader"unlit/doublesided"{Properties {_color ("Main Color", Color) = (1,1,1,1) _maintex ("Texture", 2D) =" White"{}} subshader {//Ambient PassPass {Name"BASE"Tags {"Lightmode"=" always" /*Upgrade note:changed from Pixelornone to always*/} Color[_pplambient] Settexture[_bumpmap] {constantcolor (.5,.5,.5) combine constant lerp (texture) Previous} Settexture[_maintex] {Constantcolor[_color] combine texture* Previous DOUBLE, Texture *constant}} //Vertex Lightspass{Name"BASE"Tags {"Lightmode"="Vertex"} Material {Diffuse[_color] emission[_pplambient] shininess[_shininess] specular[_speccolor]} separatespecula R on Lighting on cull off Settexture[_bumpmap] {constantcolor (.5,.5,.5) combine constant lerp (texture) Previous} Settexture[_maintex] {combine texture*previous DOUBLE, Texture *Primary}} } FallBack"Diffuse",1 }
The meaning of this shader is to put a texture on both sides of the ball. Then click on the camera and you can see the image, but you may find that the image is reversed (you may not find it, but it is actually reversed), so we have to set the scale.z value of the ball to a negative number. Basically finished here, Next is the package released, click File-build and Setting Select Android, click on the Player setting, in other setting VR Surport selected, select an SDK (recommended Google Cardboard), then build is ready. Not surprisingly, an APK file was created and installed on your big phone to see the effect. At this point you will find that the top and bottom of the deformation is more serious, the reason is because the unity of the ball model is relatively rough, this time you can build a ball in the 3dsmax, the segment set a little bigger, after the ball's normal can also be flipped, After flipping, you can use the Doubleshader.
Well, a simple but not minimalist VR picture viewer is finished, to know how to funeral, and listen to the next bb!
UNITY VR Video/Picture development experience (i)