GithubHelp home page GithubHelp logo

vr-mirrors's Introduction

VR-Mirrors

OpenVR-friendly mirror system for Unity.

Updated to work with Unity 5.4. Special thanks to Creo for providing a stereo shader technique.

Updated to work with Unity 5.4.0b24 / SteamVR 1.1.0. Special thanks to Jiman Andrei for eyeOffset & resolution fixes.

Updated to work with Unity 5.4.0f1 / SteamVR 1.1.0.

vr-mirrors's People

Contributors

ehendrikd avatar railboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vr-mirrors's Issues

Support singel pass renderer

Hey guys. Have you seen this post?

http://forum.unity3d.com/threads/5-4-beta15-reflection-rendering-wrong-in-openvr-htc-vive.398756/#post-2622845

Thanks for the reply ccs. I should have replied to this thread a while ago with an update on how I've resolved the issue. Your solution sounds reasonable enough, but it does require modifying the main camera / render passes which isn't ideal. My solution modifies the MirrorReflection code and enables it to work without requiring any changes to the main camera (ie: a single main camera rendering all layers to both eyes). It also has the added benefit that it works just fine for single-pass stereo rendering. If we could get support for creating our own stereo cameras that render to split textures, then this could be improved even further.

Basically, I modified the MirrorReflection.shader so that it has two reflection textures, one for each eye, and it samples the appropriate texture based on which eye is being rendered (you can determine this by examining unity_StereoEyeIndex when using single pass stereo rendering, or by checking the sign of unity_CameraProjection[0][2] when using traditional multi-pass stereo rendering).

The MirrorReflection.cs is then responsible for generating the appropriate texture(s) for the camera that is being mirrored. Normal monocular cameras only require a single reflection render pass. Stereo cameras require two reflection render passes (this is where having engine support for creating our own stereo cameras that render to a single side-by-side split render texture would be super useful). Unfortunately, Unity does not currently expose the per-eye details that we need from a stereo camera (ie: position/rotation of each individual eye and the projection matrix used by each eye). I had to rely on some SteamVR APIs to access this information, and haven't yet looked into how (or if) one could do this for other VR platforms.

I've attached our modified MirrorReflection scripts in case anyone is interested.

Basicly you use unity_StereoEyeIndex when single pass is used

Stereoscopic rendering breaks if not rendered as mirror

If you uncheck "Render As Mirror" on the Mirror Camera script then anything that is close (within 1 unit/meter from the mirror camera) is not rendered correctly. The stereo separation seems to be wrong and the two views do not line up correctly whereas when "Render As Mirror" is checked it renders correctly.

This image is a quick example of something like what I am experiencing:
stereovrbroken

I have tried myself to fix it but can't seem to figure out what exactly is causing the issue.
Even if this isn't going to be fixed (since this project is for mirrors) I'd really appreciate if anyone could explain why this is occurring.

Forgot to mention, this occurs in the example scene provided and in any scene I have used mirrors in. I am using a HTC Vive. Also happens in various versions of Unity.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.