Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
  • Help Room /
avatar image
0
Question by willygaelhypnovr · Mar 01, 2021 at 01:02 PM · camerarenderingvrcubemapquest

URP 7.5.3 Camera RenderToCubemap wrong result

Hello,

I'm facing an issue with URP 7.5.3 on VR devices (Oculus and Pico G2 4K)

In fact, I am trying to render a 360 stereo image during the runtime process. Therefore I used the “Camera.RenderToCubemap” function provided, for each eye, and then convert it to Equirect using the “Camera.ConvertToEquirect” to get the full texture.

         private RenderTexture leftEye;
         private RenderTexture rightEye;
         private RenderTexture equirect;
 
         public Camera LeftCameraEye;
         public Camera RightCameraEye;

 public bool shouldRenderCubemap;
 
         private void Start()
         {
            
                         leftEye = RenderTexture.GetTemporary(ResolutionWidth, ResolutionHeight, 24, RenderTextureFormat.ARGB32);
                         rightEye = RenderTexture.GetTemporary(ResolutionWidth, ResolutionHeight, 24, RenderTextureFormat.ARGB32);
                         leftEye.dimension = UnityEngine.Rendering.TextureDimension.Cube;
                         rightEye.dimension = UnityEngine.Rendering.TextureDimension.Cube;
 
                         equirect = RenderTexture.GetTemporary(ResolutionWidth, 2 * ResolutionHeight, 24, RenderTextureFormat.ARGB32);
         }
 
 
         private void LateUpdate()
         {
             if (shouldRenderCubemap)
             {
                 CaptureEye(LeftCameraEye, Camera.MonoOrStereoscopicEye.Left, leftEye);
                     CaptureEye(RightCameraEye, Camera.MonoOrStereoscopicEye.Right, rightEye);
                 shouldRenderCubemap = false;
 SaveEquirectCapture();
             }
         }
 
         private void CaptureEye(Camera eyeCamera, Camera.MonoOrStereoscopicEye eyeSide, RenderTexture target)
         {
             var rect = new Rect(0, 0, 1, 1);
             var r = eyeCamera.rect;
             eyeCamera.rect = rect;
             eyeCamera.RenderToCubemap(target, 63, eyeSide);
             eyeCamera.rect = r;
 
             target.ConvertToEquirect(equirect, eyeSide);
         }
 
         private void OnDestroy()
         {
             RenderTexture.ReleaseTemporary(leftEye);
                 RenderTexture.ReleaseTemporary(rightEye);
                 RenderTexture.ReleaseTemporary(equirect);
         }
        
 
         private void SaveEquirectCapture()
         {
             var rt = RenderTexture.active;
             RenderTexture.active = equirect;
             var stereoTex = new Texture2D(equirect.width, equirect.height, TextureFormat.ARGB32, false);
             stereoTex.ReadPixels(new Rect(0, 0, equirect.width, equirect.height), 0, 0);
 
             RenderTexture.active = rt;
 
             var bytes = stereoTex.EncodeToPNG();
             System.IO.File.WriteAllBytes(System.IO.Path.Combine(Application.persistentDataPath, "Capture_" + DateTime.Now.ToString("dd-MM-yy_H-mm-ss") + ".png"), bytes);
             DestroyImmediate(stereoTex);
         }
 

However, the result that I get from the Editor is different from the one that I get in the Headset.

Here is the result from the Editor: alt text

Here is the result from the Pico G2 Headset (the result is the same on the Oculus Quest 1): alt text

As you can see in the images, by using the same approach from the Editor and from the Headset, the image got from the headset is weird, whereas the one from the editor is what I wanted to obtain from the headset.

I'm using:

- Unity 2019.4.21ff (I got the same result with Unity 2019.4.20f1).

- URP 7.5.3.

- Oculus Quest 1.

- Pico G2 4K.

Does someone have any idea of what is happening and how to resolve this?

Thanks in advance for your reply.

stereo360-from-pico-g2-4k.jpg (134.7 kB)
stereo360-from-unity-editor.jpg (193.9 kB)
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

268 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to render a Laser Pointer always after the canvas is Rendered? 0 Answers

Camera.RenderToCubemap in VR has black edges 1 Answer

Rendering a Canvas as Screen Space - Camera - Google Cardboard 0 Answers

Single Pass rendering into a double-wide RenderTexture from a script? 0 Answers

Alembic is not rendered with VR Rig in Unity XR toolkit. 0 Answers


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