Skip to content

Shadows break stereoscopic/3D rendering with post-processing #7732

@brianchirls

Description

@brianchirls

There are certain cases where post-processing is necessary with stereoscopic rendering, e.g.:

  • cardboard distortion effect when it's not supported natively by the browser in Web VR
  • SSAO

Here's what currently happens in these cases, for each eye:

  1. Set the render target to the buffer that will be post-processed
  2. Set the scissor and viewport to half the screen (either left or right)
  3. When WebGLShadowMap.render gets called, sets its own render target and viewport, but it stores the previously set viewport
  4. When WebGLShadowMap.render is done, it sets the viewport back to half screen.
  5. When WebGLRenderer.render continues, it sets the render target again, but setRenderTarget sets the viewport to the full size of the render target.
  6. WebGLRenderer renders the scene at full size, across both eyes, breaking the output.

Somewhere at or after step 5, we need to be able to set the viewport back to the half screen values set in step 2.

While we're at it, as a bonus, it'd be nice to have a way to only render the shadow map one time. Repeating for the second eye is redundant.

(cc @borismus)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions