Search Unity

MAJOR ISSUE with Unity Shadows and Parallax Textures in VR

Discussion in 'AR/VR (XR) Discussion' started by Protozoaire, Mar 10, 2016.

  1. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    --- EDIT ---

    Half-Fixed with latest Unity 5.4.0b9 released (see below for more info).

    --- END OF EDIT ---


    Hi,

    When the shadows are activated, then all the parallax textures looks flat in the HMD.
    If we don't activate shadows, parallax textures looks great again !

    So now I need to choose between bump mapped textures OR shadows in my game ...





    Anyone knows how to fix that issue ?
     
    Last edited: Mar 12, 2016
  2. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    For info, tested with latest Unity 5.3.3f1 (64-bit) on Windows 10 Pro x64 with 0.8 Oculus runtime.
     
  3. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    - Disable "receive shadows" on the height mapped object doesn't help.
    - When my game was using the 0.4.4 Oculus runtime without "VR Supported" checked in Unity it was working with shadows on them.
    - I've tryed Parallax Bumped shader and it's not working too :S
    - The relief pack from the Asset Store is $49 and it's not sure it will work ...

    In my game, there is 90% of my objects that use Parallax mapping, I've spend a lot of time with 0.4.4 runtime to make it right

    Bug reported to Unity but I never had an answer from them for previously reported bugs ...
     
  4. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    To quickly reproduce the issue :

    Make a new scene with an OVRPlayer and a simple box.
    Apply parallax texture (albedo, normal and height maps) to it (standard shader is the best for what I've seen).
    Add a light, make sure the lightning is build then click Play.

    1) In game you won't see the 3d effects on the box.

    2)Then deactivate shadows projected by the light (or click "no shadows" in the project quality).
    You now see 3d effects on the box.
     
  5. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
  6. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    Tested with the latest Unity 5.4.0b9 released : March 8, 2016

    At first the parallax textures looks flat.
    Then I looked everywhere and see a new Option in Player / Other Settings called "Single-Pass Stereo Rendering".



    That do the trick ! ... except for static GameObjects (case 778568) :



    So I tried unchecking the static checkbox ... and it works !



    ---

    I also noticed (case 779207) that TextMesh GameObjects with a GUI/Text Shader no longer works. It seems far away :



    If I uncheck "Single-Pass Stereo Rendering" it works again.
    So I tryed with 3D Text Shader and it works ! ... but a new issue appeared :
    - If we make the color black, it's transparent.
    - If it's grey, it's half-transparent.
    - And white is classical non transparent white (for that issue it's not related to VR) :

     
    Last edited: Mar 12, 2016
  7. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150
    Hi Pierre,

    I just want to figure out what the current situation is, to make sure I've got it all clear in my mind:

    - You have an object with a parallax mapping shader, which when viewed in VR looks genuinely like parts of the object are closer than others.

    - You also have the standard Unity shadows turned on (what kind of light source?).

    - If you have Single-Pass Stereo Rendering off and look at the shadows in VR, the shadows do not look correct and it looks as if the surface is flat, which combats the illusion of a bumpy surface. (Could you take a screenshot of this for me so I can visualise?)

    - If you have Single-Pass Stereo Rendering ON and look at the shadows in VR, the shadows do look correct (could you take a screenshot of this for me too?).

    ( With Single-Pass Stereo Rendering ON there is an issue with font rendering. Suggest we tackle the VR shadows issue first and then move onto discussing this later. )

    Is that all accurate?

    Dave
     
  8. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    Hi Dave,

    The issue is on texture rendering, flat shadows are less important to me because it's less visible for the player.

    I'll try to be as clear as possible :

    1) There is indeed an issue with parallax mapping shader in VR if a light in the scene have its shadows type configured to "hard shadows" or "soft shadows" :
    - If Single-Pass Stereo Rendering is OFF, then textures and shadows are looking flat (there is no illusion of a bumpy surface). I can take a screenshot but it's only visible in VR. So if you really need it please tell me.
    - If Single-Pass Stereo Rendering is ON, then textures are looking great (good illusion of a bumpy surface). Shadows are still looking flat on these bumpy surfaces but still, textures are good.

    2) I have a static object with a parallax mapping shader which when viewed in VR with Single-Pass Stereo Rendering ON do not appear correctly on the left eye. It seems only left camera rendering is updated at a specific angle.
    If I make that object non-static, it looks good again at every angles.

    3) The lightning source is directional in my example but it's the same issue with all others lightning source.

    4) For the font rendering that looks far away with Single-Pass Stereo Rendering ON, we can see that later of course ;)
     
  9. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150
    Yeah, a screenshot would be useful. So are you saying that if shadows are turned on, even if the shadows are casting nowhere near the object in question, the parallax mapping shader stops working in VR mode?

    What happens if you hook up the shadows being on or off to a keypress (e.g. S), can you see the parallax mapping popping in and out?
     
  10. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    Exactly ! If I hook up the shadows being on or off to a keypress I can see the parallax mapping popping in and out.

    Here are the screenshots :