10-13-2019 07:13 PM
10-25-2019 05:15 PM
10-26-2019 06:16 PM
10-26-2019 08:26 PM
Shader "Kojack/PanoSpherical"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
Cull off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
//#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float3 world : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.world = mul(unity_ObjectToWorld, v.vertex)*float3(-1,-1,1);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float3 p = normalize(i.world);
float r = sqrt(dot(i.world, i.world));
float theta = atan2(i.world.z, i.world.x)/(3.14159265*2.0)+0.5;
float phi = acos(i.world.y / r) / 3.14159265;
return tex2Dlod(_MainTex, float4(theta,phi,0.0,0.0));
}
ENDCG
}
}
}
11-08-2019 05:27 PM
11-08-2019 05:59 PM
11-08-2019 07:35 PM
11-16-2019 01:56 AM
01-28-2022 01:01 AM
That's it.. you nailed it i have been looking at my 360 photos in the VR but it was just weird looking down couldn't work out what it was. I understand what you mean about the distortion towards the edges of your flat plane where it meets the sphere because you are looking at the image side ways. was just wondering what if instead of the flat plane what if it was a large radius sphere the ideal shape would be a ball with a bottom that sits flat see image attached
01-30-2022 06:31 AM
What a difference! Thank you kojack.
It would be nice to see this function in mediaplayer like Pigasus, etc.
But warning, its not goog for every mono 360 pano, only from what was taken from around 1.5m, right? 🙂
So my drone shots doesn't need such correction at all!