Search Unity

Stereoscopic 3D system for Unity 2019 & 2020, default render + Post Processing Stack v2, URP, HDRP

Discussion in 'Made With Unity' started by Vital-Volkov, Jan 7, 2021.

  1. Vital-Volkov

    Vital-Volkov

    Joined:
    Mar 30, 2015
    Posts:
    4
    8xMSAA&TAA.png

    Hi!
    Finally, I made and polish my stereoscopic 3D settings system and decided to publish it for all on GitHub - https://github.com/Vital-Volkov/Stereoscopic-3D-system-for-Unity-2019-

    My research was started here a long time ago - https://forum.unity.com/threads/stereo-3d-in-unity-3d.63874

    I using the system in my projects and wish that all developers include the correct Stereo 3D system in their great projects and S3D users no more feel pain using 3rd party abandoned injector drivers like iZ3D, Tridef(DDD), 3D Vision, etc with the incorrect setting system, wrong depth effects, and risk to be banned in online gaming.
    Also, production of 3D Monitors and TVs should be returned with 4K OLED horizontal interleaved method - is a must-have. ;) Because VR HMD's is not a replacement of a monitor, it's an addition, and not so comfortable as monitor + light glasses. I spent many thousands of hours in VR with my Zalman glasses and LG D2342P monitor(horizontal interleaved method `Cinema 3D`) sometimes gaming many days nonstop over 12 hours per day, I know what I'm talking about.

    While research render methods and testing I found how to increase performance:
    1) If `OnRenderImage` function(even empty) exist in script. +2.6%
    2) Set projection matrix for Left/Right cameras instead of using `Physical Camera` `Lens Shift`. +2%
    3) Set Zero projection matrix of Main camera or near plane to `-1` in Scriptable Render Pipeline. + 4.4%
    4) Set Render Texture format from `Default` to `DefaultHDR`. + 2%
    5) Set Render Texture format from `DefaultHDR` to `RGB111110Float`. + 1%
    In total +12.3% of fps in Unity's `3D+Extras` demo scene and 19.3% in my project as a bonus. :D
    Also `Don't Clear` flag for the background is slower than leave default Skybox or Color.
     
    Last edited: Jan 17, 2021
  2. Vital-Volkov

    Vital-Volkov

    Joined:
    Mar 30, 2015
    Posts:
    4
    I also made a build with Unity default demo scene with `Post Processing Stack V2`:

    7z - https://github.com/Vital-Volkov/Ste...-Unity-2019-/blob/main/Stereo3D_Unity_Demo.7z

    or

    zip - https://drive.google.com/file/d/1cORanOGO8Elsz7Cn8yj2XwyNVYY5t9lg/view?usp=sharing

    Post-process effects: Color Grading, Bloom, Motion Blur, Vignette, Ambient Occlusion, Depth Of Field, Temporal Anti-aliasing.
    Run via `3DWE.exe` for `Fullscreen Windowed` mode with VSync or `3DWE.exe - Exclusive Fullscreen_noVSync` for `Exclusive Fullscreen` mode without VSync.

    Key Controls:
    `W,S,A,D` moving, `Q,E` down/up
    `Tab` - hide/show Stereo3D settings panel
    `*` On/Off S3D, `Ctrl + *` swap left-right cameras
    `+,-` Field Of View, `Ctrl + `+,-`` custom `Virtual IPD` when unchecked `Match User IPD`
    All above keys + `Left Shift` for faster changes
    `Mouse` Look around
    `Esc` exit

    When launch, Monitor's Pixels Per Inch(PPI) will be autodetected and precision screen width will be calculated,
    as result - settings will be in real millimeters so you don't need to set `PPI` or `Pixel Pitch` manually, set it only if `PPI` incorrect.
    Set `User IPD` to your own interpupillary distance(IPD) for a realistic view with infinity S3D depth.
    Or set `User IPD` lower than your own IPD for close distance max depth(aquarium back wall effect).
    Uncheck `Match user IPD` and set `Virtual IPD`(Cameras IPD in the virtual world) larger than your own IPD for toy world effect and vise versa.
    With realistic IPD's `Screen Distance` will show how far from the screen your eyes should be(camera's point) where Real and Virtual FOV will match and you get a 100% realistic view. (Very important for Vehicle Simulators).
     
    Last edited: Feb 1, 2021
  3. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Hi there!
    Thank you very much for releasing this!
    I just unearthed my Philips 4k 3DTV with passive stereoscopic 3D and I will be implementing stereoscopic 3D support for my game (work in progress).

    I made my own stereoscopic camera system a long time ago, but yours seems more polished.
    My system just rendered to 2 cameras, one for each eye, with a shifted camera matrix each.
    Are you doing it like that too?
    The problem with this approach is that Unity will have to render the whole scene twice, instead of processing it a single time and rendering on both sides at once:

    There are more sophisticated ways to do that that will render much faster, but require the use of the XR framework:

    As I said, I just used the first method.
    I guess you are using this method too, isn't it?
     
  4. VRS3DGuru

    VRS3DGuru

    Joined:
    Sep 21, 2017
    Posts:
    14
    This is great work.
    Do you have any idea how to make Clone Mode 3D Stereo output? This is where the Windows Desktop is set to "CLONE or Mirror" and not extended desktop. Nvidia Control Panel is set to CloneMode 3D also. I am using HDRP so no OpenGL option. Wondering if there is a way to get Clone Mode and secondarily active 3D mode? I'm afraid of using the DirectX 11.x option because I hope to use DirectX 12.x with Raytracing for the project eventually.