Skip to content

Strange shadow artifacts show up in VR HMD #17

Open

Description

@ccll

We're a VR HMD manufacturer and we've been connected our own headset to the OSVR with a custom plugin.
When we use the OSVR-Unity package to develop a demo content, we inspected some shadow artifacts only showing up in the headset.

This image is the preview window in Unity, and there are no artifacts.
preview

The same scene shot through the headset's lens, there are shadows on the cloud.
bad1

And even stranger, when the headset pitches up gradually, the shadows disappear one-by-one, as below.
bad2
bad3
bad4

Our server config:

{
    "display": "displays/xxxx.json",

    "server": {
        "sleep": 1 
    },

    "renderManagerConfig": {
        "meta": {
            "schemaVersion": 1
        },
        "renderManagerConfig": {
            "directModeEnabled": false,
            "directDisplayIndex": 0,
            "directHighPriorityEnabled": true,
            "numBuffers": 2,
            "verticalSyncEnabled": true,
            "verticalSyncBlockRenderingEnabled": false,
            "renderOverfillFactor": 1.0,

            "window": {
                "title": "xxxx",
                "fullScreenEnabled": true,
                "xPosition": 1920,
                "yPosition": 0
            },

            "display": {
                "rotation": 0,
                "bitsPerColor": 8
            },

            "timeWarp": {
                "enabled": true,
                "asynchronous": false,
                "maxMsBeforeVSync": 5
            }
        }
    }
}

Our display config:

{
  "meta": {
    "schemaVersion": 1
  },
  "hmd": {
    "device": {
      "vendor": "xxxx",
      "model": "xxxx",
      "num_displays": 1,
      "Version": "1.0",
      "Note": ""
    },
    "field_of_view": {
      "monocular_horizontal": 100.0,
      "monocular_vertical": 112.5,
      "overlap_percent": 100,
      "pitch_tilt": 0
    },
    "resolutions": [
      {
        "width": 2560,
        "height": 1440,
        "video_inputs": 1,
        "display_mode": "horz_side_by_side",
        "swap_eyes": 0
      }
    ],
    "distortion": {
        "type": "rgb_symmetric_polynomials",
        "distance_scale_x": 1,
        "distance_scale_y": 1.125,
        "polynomial_coeffs_red":   [ xxxx ],
        "polynomial_coeffs_green": [ xxxx ],
        "polynomial_coeffs_blue":  [ xxxx ]
    },
    "rendering": {
      "right_roll": 0,
      "left_roll": 0
    },
    "eyes": [
      {
        "center_proj_x": 0.6,
        "center_proj_y": 0.5,
        "rotate_180": 0
      },
      {
        "center_proj_x": 0.4,
        "center_proj_y": 0.5,
        "rotate_180": 0
      }
    ]
  }
}

Spec:

i7-4790k
NVIDIA GTX970
Windows 7 64bit
Unity3D 5.3.1f1
OSVR-Unity-v0.6.8-with-core-v0.6-1186-gacfbf41-build369

Activity

  1. DuFF14 commented on Apr 27, 2016

    @DuFF14
    Member

    Hi @ccll,
    Does this happen on other HMDs, or just the one you are manufacturing?
    It looks like a far clipping plane issue in Unity. I would narrow in on the differences between the preview camera and the eye cameras. You can set the clipping planes for the eye cameras: https://github.com/OSVR/OSVR-Unity/blob/master/OSVR-Unity/Assets/OSVRUnity/src/DisplayController.cs#L205

    Given this information, I don't think there's an issue with the rendering plugin or config files. It's probably something in Unity.

  2. ccll commented on Apr 29, 2016

    @ccll
    Author

    @DuFF14 I've found out how to reproduce this.
    I've tested with our own HMD, an Oculus Rift DK2, and a third party Rift DK2 compatible HMD, all 3 HMDs behave the same if center_proj_x is the same.

    0.5/0.5 == NO artifacts
    values other than 0.5/0.5 (for example 0.51/0.49) == ARTIFACTS!!

    Our own HMD has a center_proj_x approximately at 0.6/0.4, while DK2 is 0.5/0.5, so in previous test the artifacts only show up in our own HMD, until I messed with DK2 settings.

    I don't know the internals of COP handling, but I suppose it affects projection matrix, and I recall some articles mentioned that custom projection matrix can break shadows in Unity3D. Is that relevant here?

  3. DuFF14 commented on Apr 29, 2016

    @DuFF14
    Member

    Aha, thanks for the info. I hadn't heard about that custom projection matrix problem, but it sounds like it could be related. I will look into it..

  4. russell-taylor commented on May 2, 2016

    @russell-taylor
    Contributor

    See https://github.com/OSVR/OSVR-Docs/blob/master/Configuring/projectionAndViewMatrices.md for a description of the OSVR RenderManager transformations. Details of the meanings for center of projection, fields of view, overlap percentage and so forth are in https://github.com/OSVR/OSVR-Docs/blob/master/Configuring/distortion.md and to see how to programmatically set them from a new HMD along with distortion correction, see https://github.com/OSVR/distortionizer/blob/master/angles_to_config/doc/anglesToConfig.md

  5. ccll commented on May 24, 2016

    @ccll
    Author

    Just discovered that the shadow artifacts only show up in dynamic lighting, when we bake all lights into static lightmaps there are no artifacts.

  6. DuFF14 commented on May 24, 2016

    @DuFF14
    Member

    @ccll Are you using forward or deferred rendering? Can you test if the other option gives you the same artifacts?

  7. ccll commented on May 26, 2016

    @ccll
    Author

    @DuFF14 Confirmed that both forward and deferred rendering produces the artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions