Search Unity

HDRP and stereo 360 capture

Discussion in 'High Definition Render Pipeline' started by jcdeblok, Sep 21, 2019.

  1. jcdeblok

    jcdeblok

    Joined:
    Oct 15, 2015
    Posts:
    3
    What the state of 360 stereo capture while using HDRP? Stereo doesn't seam work, These produce the exact same image.

    cam.RenderToCubemap(cubemapLeftEye, 63, Camera.MonoOrStereoscopicEye.Left); cam.RenderToCubemap(cubemapRightEye, 63, Camera.MonoOrStereoscopicEye.Right);

    Eye separation is set correctly and 'capture 360 stereo' flag is set correctly is the project settings.

    Is this still under construction or is it a bug?
     
    Waterlane likes this.
  2. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    447
    *bump* having this feature in URP and HDRP as it is in the standard pipeline would be great.
     
  3. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, Stereo 360 capture is currently supported only for built-in renderer. There is plan for support for SRP but no ETA.
     
  4. lucidtripper

    lucidtripper

    Joined:
    Aug 3, 2017
    Posts:
    22
    I found a work around = in URP - that solves the no IPD separation issue in stereo 360 output

    child 2 offset camera objects (L & R) to a centre "mono" camera / empty game object
    L camera transform x = -0.0017 and R camera x = 0.0017 (try values until the scale in VR looks right)
    cubeMode = 63 = renders all 6 sides of the cube - but this choked my system - so I run / record 2 passes with different cubeMode settings and merge them in after-effects later... eg. cubeMode = 83 (front, left, right) and then cubeMode = 44 (rear, top, bottom)

    also: I record the output using KLAK Spout sender to OBS : https://github.com/keijiro/KlakSpout
    (OBS can receive this signal direct, no need to involve an external 4k monitor etc)

    the mono option in this script uses left eye view - this maintains the direction the camera object is facing - if you use mono then you lose all camera angles - can be useful if you want the viewer to make their own decisions which way to face


    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.UI;
    4. using UnityEngine.Rendering;
    5.  
    6. [ExecuteInEditMode]
    7. public class MonoStereo360 : MonoBehaviour
    8. {
    9.     public Camera camL;
    10.     public Camera camR;
    11.     public int cubeMode = 63; // all 6 sides of the cube
    12.     public RenderTexture cubemapLeft;
    13.     public RenderTexture cubemapRight;
    14.     public RenderTexture equirect;
    15.     public bool renderStereo = true;
    16.     public float stereoSeparation = 0.064f; // redundant
    17.  
    18.     private void Awake()
    19.     {
    20.         { Application.targetFrameRate = 48; }
    21.     }
    22.     void LateUpdate()
    23.     {
    24.        if (renderStereo)
    25.         {
    26.             camL.stereoSeparation = stereoSeparation; camR.stereoSeparation = stereoSeparation;
    27.             camL.RenderToCubemap(cubemapLeft, cubeMode, Camera.MonoOrStereoscopicEye.Left);
    28.             camR.RenderToCubemap(cubemapRight, cubeMode, Camera.MonoOrStereoscopicEye.Right);
    29.             cubemapLeft.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Left);
    30.             cubemapRight.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Right);
    31.         }
    32.         else
    33.         {
    34.             camL.stereoSeparation = 0; // mono 360
    35.             camL.RenderToCubemap(cubemapLeft, cubeMode, Camera.MonoOrStereoscopicEye.Left);
    36.             cubemapLeft.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Mono);
    37.         }
    38.     }
    39. }
     
    Last edited: Apr 25, 2022
  5. thelghome

    thelghome

    Joined:
    Jul 23, 2016
    Posts:
    742
    It's not a correct way to duplicate and offset two cameras(LR) from center, you will only get 2 mono panoramas from two viewing points. In other word, the zero parallax is completely wrong.

    Tested with the latest Unity 2023, as Unity team said, RenderToCubemap render mono only in URP.
    Hopefully they can add stereo 360 render support in URP, it's been a while...