Unity sees problems with sphere inside, through sphere playing panoramic video

Source: Internet
Author: User

Unity creates a sphere the default is not to see the inside of the sphere, so you need to use cull Front to modify the direction of culling, which will bring a new problem, The video being played is flipped like a mirror, so change its UV coordinates so that it flips over to float u_x=1-i.uv.x; float u_y=i.uv.y; i.uv=float2(u_x,u_y);

1Shader"Unlit/unlitshader"2 {3 Properties4     {5_maintex ("Texture", 2D) =" White" {}6     }7 Subshader8     {9Tags {"Rendertype"="Opaque" }TenLod - OneCull Front//remove the front to see the inside of the sphere A          - Pass -         { the Cgprogram -             #pragmaVertex vert -             #pragmaFragment Frag -             #pragmaMulti_compile_fog +              -#include"Unitycg.cginc" +  A             structAppData at             { - float4 vertex:position; - float2 uv:texcoord0; -             }; -  -             structv2f in             { - float2 uv:texcoord0; toUnity_fog_coords (1) + float4 vertex:sv_position; -             }; the  * sampler2d _maintex; $ float4 _maintex_st;Panax Notoginseng              - v2f Vert (AppData v) the             { + v2f o; AO.vertex =Unityobjecttoclippos (V.vertex); theO.UV =Transform_tex (V.UV, _maintex); + Unity_transfer_fog (O,o.vertex); -                 returno; $             } $              - fixed4 Frag (v2f i): Sv_target -             { the  -                 floatu_x=1-i.uv.x;//because the inside of the ball is like a mirror.Wuyi                 floatU_Y=I.UV.Y;//so to change its UV coordinates theI.UV=FLOAT2 (u_x,u_y);//just change x, that's it, okay? -  Wu  -Fixed4 col =tex2d (_maintex, I.UV); About Unity_apply_fog (I.fogcoord, col); $                 returnCol; -             } - ENDCG -         } A     } +}

Unity sees problems with sphere inside, through sphere playing panoramic video

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.