Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
11 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Brad-Lee · Aug 09, 2015 at 12:05 PM · unity 5cameravroculuspost processing

Applying Image Post-Processing Effects to Right Eye

I am running unity 5.1.2f1.

The change to VR has made the main camera automatically a Stereoscopic camera, which responds to HMD rotational input without me having a say on the matter.

The main problem is that we have post-processing scripts attached to the camera for some postprocessing effects such as motion blur and glowing outlines, but those effects do not appear on the 'Right Eye' view.

Is it possible to affect the other eye with an 'OnRenderRightImage' callback or through some other means?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Brad-Lee · Aug 09, 2015 at 12:05 PM 0
Share

Also, a way to disable H$$anonymous$$D rotational input in u5.1 would be awesome :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Paul_Bronowski · Nov 01, 2016 at 10:05 AM

Unity 5.4 supports a dual-pass camera for Both eye configuration. It's tough to determine which eye is being rendered, but you can see it in the camera target texture name. Here's a script that works for me with the Vive...

         /// <summary>
         /// OnPreRender is called before a camera starts rendering the scene.
         /// Note: For Stereoscopic rendering on Unity 5.4+, we'll be called twice - once for each eye.
         ///       The projection matricies will change accordingly, and we'll need to apply them to the cameras in our stack
         /// </summary>
         private void OnPreRender()
         {
             if (this._PostProcessingFXCamera == null ||
                 this._CameraStackByDepth == null)
             {
                 return;
             }
 
             // Get a temporary RenderTexture based on this._PostProcessingFXCamera.targetTexture
             // Now, the docs say RenderTexture.GetTemporary() maintains a cache, but why even incur the overhead of making the call?
             // We'll be good memory citizens and call DiscardContents() in this.OnRenderImage().
             if (this._TempRenderTexture == null)
             {
                 RenderTexture sourceTexture = this._PostProcessingFXCamera.targetTexture;
                 if (sourceTexture == null)
                     return;
                 this._TempRenderTexture = RenderTexture.GetTemporary(sourceTexture.width,
                                                                      sourceTexture.height,
                                                                      sourceTexture.depth,
                                                                      sourceTexture.format,
                                                                      RenderTextureReadWrite.Default,
                                                                      this._AntiAliasingLevel);
             }
 
             // Render each camera in the stact to targetTexture
             for (int i = 0; i < this._CameraStackByDepth.Length; i++)
             {
                 Camera camera = this._CameraStackByDepth[i];
                 camera.targetTexture = this._TempRenderTexture;
                 // TODO: We seem to be able to to get away with setting only these two. See if we can reduce this to one.
                 camera.projectionMatrix = this._PostProcessingFXCamera.projectionMatrix;
                 camera.nonJitteredProjectionMatrix = this._PostProcessingFXCamera.nonJitteredProjectionMatrix;
                 //camera.worldToCameraMatrix = this._PostProcessingFXCamera.worldToCameraMatrix;
                 camera.Render();
                 camera.targetTexture = null;
             }
 
         }
 
 
         /// <summary>
         /// OnRenderImage is called after all rendering is complete to render image.
         /// Note: For Stereoscopic rendering on Unity 5.4+, we'll be called twice - once for each eye.
         /// </summary>
         /// <param name="src"></param>
         /// <param name="dest"></param>
         private void OnRenderImage(RenderTexture src, RenderTexture dest)
         {
             if (this._TempRenderTexture == null)
                 return;
             Graphics.Blit(this._TempRenderTexture, dest);
             this._TempRenderTexture.DiscardContents();
         }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Disabling VR Camera rotation creates ''cinema'' effect in VR device 1 Answer

Draw texture directly on Oculus screen 1 Answer

Post processing splits in VR - oculus 0 Answers

Does Oculus utilities for Unity 5 have a toe-in camera set now? 0 Answers

What version of unity works with the Samsung Gear VR innovator edition for Note 4? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges