Search Unity

Distortion shader

Discussion in 'Daydream' started by hray, Jan 17, 2017.

  1. hray

    hray

    Joined:
    Dec 5, 2016
    Posts:
    2
    I'm looking for a way to play with the distortion shader, the one that renders each eyes to a RenderTexture in order to match the lenses distortion.
    I found the adequate code in StereoRenderEffect.cs, but because of
    #if !UNITY_HAS_GOOGLEVR || UNITY_EDITOR​
    it only works in the editor. I'd like to tweak the shader myself, the one that runs on the actual device.

    I noticed that when the
    DistortionCorrectionMethod == Native, it uses a NDK/C++ program to do so, but I can't locate the shader itself.

    Any hint of where to look ?
     
  2. Fabian-Haquin

    Fabian-Haquin

    Joined:
    Dec 3, 2012
    Posts:
    231
    Have you check into Unity builtin shaders ?
    Into DefaultResourcesExtra/VR/

    Otherwise if you are just looking for a similar shader, you should be able to find what Oculus used before it was native to Unity by downloading any Unity 4 integration before 1.3.0 on https://developer3.oculus.com/downloads/

    With this package you really have two cameras with two render texture, one for each eye in your scene. (I don't know if it still work with a CV1 but it used to work with a DK2 and DK1 with the beta runtime).
     
    Last edited: Jan 17, 2017
  3. hray

    hray

    Joined:
    Dec 5, 2016
    Posts:
    2
    Thanks, I'll check if I can use the DefaultResourcesExtra/VR/.
    Actually, I just want to tint the whole image, but adding a fullscreen image effect is too expensive, and doesn't work at the moment anyway (source).
    So I wanted to piggyback on that shader since it has to be used at some point anyway.
     
  4. Fabian-Haquin

    Fabian-Haquin

    Joined:
    Dec 3, 2012
    Posts:
    231
    I'm guessing you are on Unity 5.6 Beta ?
    You will be able to add post-processes probably in a new beta release soon tho.
    I don't know if you will be allowed to access this shader in 5.6...

    What if you use the Unity 5 integration of Google VR SDK which can be used between Unity 5.2.1 and Unity 5.5.0 ?