I want my camera to render like a 360 video. Is it possible?

Hello guys,

I’m looking to create a game where the camera will render the word like a 360° video on youtube but flat.
I want a rectangle with the world a bend inside it and where the player can see all over himself in one screen. It has to look like the following picture , but only one half is enought for me, I don’t want to make 3D.

The picture comes from a unity blog article about capturing a video on a 360° format.
I look for the same render but I dont want to capture a video. The player should be able to play and seing this render…
Do you have any clue in what direction can I search for informations about making that ? Maybe I can solve this problem by making a shader who’ll move the vextex and bend the world ?

I’m interested in any solution no matter if it’s a paid asset, or maybe hire someone or making my own shader.
For now I’m stuck because I don’t know in what direction I should search. And maybe it’s not possible…

Thank you for your help and sorry for my english.

Dan

Try google “Quake 360 camera”, if I remember correctly you can get full source of this project.

Thank you I’ll take a loot at the source code. I presume it’s a shader or something. Any other clues?

It’s shader have two problem:
1st age of screen is warp zone, I think it can be fixed with geometry shader, but I never use them before.
2nd Far away objects become too small too fast.

Shader "Unlit/CylProj"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {
            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
            {
                float2 uv : TEXCOORD0;
                UNITY_FOG_COORDS(1)
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;

            v2f vert (appdata v)
            {
                v2f o;

                float4 worldPos = mul(unity_ObjectToWorld, v.vertex);

                float angleY = atan2(worldPos.z, worldPos.x);
                angleY/=UNITY_TWO_PI;
                float dist = length(worldPos);

                worldPos.z = dist;
                worldPos.x = angleY;

                worldPos.y/=10;
                worldPos.y *= -1;
                worldPos.w = 0.5;

                worldPos.z /= 100;
                worldPos.z = 0.5-worldPos.z;


                o.vertex = worldPos;

                o.uv = TRANSFORM_TEX(v.uv, _MainTex);
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                // sample the texture
                fixed4 col = tex2D(_MainTex, i.uv);
                UNITY_APPLY_FOG(i.fogCoord, col);
                return col;
            }
            ENDCG
        }
    }
}

Thank you for the shader and the video. It’s very helpfull.
This cylindral projection is a good start. Has the shader have to be applied on each object ? Would be possible to make a shader like a post-processing effect who make the job ?

I think you may do render to cubemap then do opposite thing to what I did in that shader: remap x axis of camera space(angle) to xz component of vector and use a Y component as is. Then you get that vector and sample with them from cubemap.
I suspect Unity already have tool for render a panoramic texture, and you just missed it somehow.