Created
November 2, 2017 09:00
-
-
Save joshiaj7/39784df478309d964de76b397fa8e4f1 to your computer and use it in GitHub Desktop.
My Augmented Reality + 360 view scripts using Unity3D and Vuforia SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this shader is used for inverting image of 360 view in a sphere | |
Shader "Unlit/360Shader" | |
{ | |
Properties | |
{ | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_Color ("Main Color", Color) = (1,1,1,0.5) | |
} | |
SubShader | |
{ | |
Tags { "RenderType" = "Opaque" } | |
//This is used to print the texture inside of the sphere | |
Cull Front | |
CGPROGRAM | |
#pragma surface surf SimpleLambert | |
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) | |
{ | |
half4 c; | |
c.rgb = s.Albedo; | |
return c; | |
} | |
sampler2D _MainTex; | |
struct Input | |
{ | |
float2 uv_MainTex; | |
float4 myColor : COLOR; | |
}; | |
fixed3 _Color; | |
void surf (Input IN, inout SurfaceOutput o) | |
{ | |
//This is used to mirror the image correctly when printing it inside of the sphere | |
IN.uv_MainTex.x = 1 - IN.uv_MainTex.x; | |
fixed3 result = tex2D(_MainTex, IN.uv_MainTex)*_Color; | |
o.Albedo = result.rgb; | |
o.Alpha = 1; | |
} | |
ENDCG | |
} | |
Fallback "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment