Hello! I have 360 stereoscopic images and am building a unity application that will play them on a 3D curved video wall. The wall itself sort of functions like a HMD and requires special scripts to properly play the unity app as upon launch the wall creates 3 cameras to cover the large surface area. These specialized scripts require Unity 2018.4.12f1 (this backstory is probably very confusing... i apologize!) The developer of the wall has given me the following script that helps map the 3D image to left and right eyes: Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class StereoCameraController : MonoBehaviour { // Start is called before the first frame update void Start() { Camera[] cameras = Camera.allCameras; for(int i = 0; i < Camera.allCamerasCount; i++) { Camera cam = Camera.allCameras[i]; if(i%2 == 0) cam.cullingMask &= ~(1 << LayerMask.NameToLayer("right")); else cam.cullingMask &= ~(1 << LayerMask.NameToLayer("left")); } } } This script works great 360 Images mapped onto an inverted sphere, however, these spheres always has a bad zenith/nadir seam, so I want to try with a skybox instead. The tricky part is getting the above code to work with the skybox. I have been using the following script to create a stereoscopic skybox shader (below), but I need to find a way to apply a layermask (left/right) to the images the shader produces. Code (CSharp): // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) Shader "Skybox/CubemapStereo" { Properties{ _Tint("Tint Color", Color) = (.5, .5, .5, .5) [Gamma] _Exposure("Exposure", Range(0, 8)) = 1.0 _Rotation("Rotation", Range(0, 360)) = 0 [NoScaleOffset] _TexLeft("Cubemap (HDR)", Cube) = "grey" {} [NoScaleOffset] _TexRight("Cubemap (HDR)", Cube) = "grey" {} } SubShader{ Tags { "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" } Cull Off ZWrite Off Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma target 2.0 #include "UnityCG.cginc" samplerCUBE _TexLeft; samplerCUBE _TexRight; half4 _TexLeft_HDR; half4 _TexRight_HDR; half4 _Tint; half _Exposure; float _Rotation; float3 RotateAroundYInDegrees(float3 vertex, float degrees) { float alpha = degrees * UNITY_PI / 180.0; float sina, cosa; sincos(alpha, sina, cosa); float2x2 m = float2x2(cosa, -sina, sina, cosa); return float3(mul(m, vertex.xz), vertex.y).xzy; } struct appdata_t { float4 vertex : POSITION; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct v2f { float4 vertex : SV_POSITION; float3 texcoord : TEXCOORD0; UNITY_VERTEX_OUTPUT_STEREO }; v2f vert(appdata_t v) { v2f o; UNITY_SETUP_INSTANCE_ID(v); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); float3 rotated = RotateAroundYInDegrees(v.vertex, _Rotation); o.vertex = UnityObjectToClipPos(rotated); o.texcoord = v.vertex.xyz; return o; } fixed4 frag(v2f i) : SV_Target { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); half4 tex; half3 c; if (unity_StereoEyeIndex == 0) { // Left Eye tex = texCUBE(_TexLeft, i.texcoord); c = DecodeHDR(tex, _TexRight_HDR); } else { // Right Eye tex = texCUBE(_TexRight, i.texcoord); //tex = half4(1,0,0,1); c = DecodeHDR(tex, _TexRight_HDR); } c = c * _Tint.rgb * unity_ColorSpaceDouble.rgb; c *= _Exposure; return half4(c, 1); } ENDCG } } Fallback Off } I feel like it would be around the //Left Eye //Right Eye comments that I would like to assign the proper layers.
I am using panoramic skybox shader with over/under stereoscopic render. https://forum.unity.com/threads/how-to-stereoscopic-image-to-skybox-dome-for-vr.1257765/ Check if in your unity version (old) has Skybox/Panoramic shader "3D Layout" option. This video shows Quest 2 stereoscopic render from Blender. This pictures creates fully 3D depth in headset. Of course 3DOF only...
So, you need to create better 3D sphere in MAX, Blender... with better geometry at poles. Native Unity sphere is not good, problem is not in stereoscopic (or classic mono 360x180 panorama) image.
I made a new sphere in Blender which really helped fix the seams of the equirectangular image but there was a little wrinkle still present. This wrinkle was fixed by turning off Generate MipMaps. Problem solved, thank you all!