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 /
avatar image
0
Question by BigFluffyCookie · Jan 19, 2021 at 01:01 PM · shaderassetbundleoculus

Single pass (multiview) with OpenGLES3 or Vulkan behaves unexpected when building on Oculus Quest 2

So I am trying to use single pass or in oculus case multiview for my VR application. Now I have noticed weird behavior with the shader that I am using. This is with Unity version 2020.1.13f1 and OpenGLES3.

I import an asset bundle via script that has an object with a texture and shading on it, when I try to build this its just black and I get this error "Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 353. OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state".

Now the weird thing about this is when I put the same object with texture and shader in my project instead of loading it via assetbundles and then build it it works fine.

In my shader I have currently set:
#pragma multi_compile __ UNITY_STEREO_MULTIVIEW_ENABLED
#pragma multi_compile_instancing

In appdata
UNITY_VERTEX_INPUT_INSTANCE_ID

In struct v2f
UNITY_VERTEX_OUTPUT_STEREO

In v2f vert
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

GPU Instancing is also enabled.

I don't quite understand how this happens so any help would be appreciated!

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by BigFluffyCookie · Jan 20, 2021 at 12:32 PM

Alright so I figured something out. The reason why the shader would work when in the project but not when in an asset bundle that gets loaded in during runtime seems to be that the shader got compiled in a different unity project when creating the asset bundle and the macros for vertex stereo output seem to get ignored (even with #pragma multi_compile_instancing defined in the shader!). Since the asset bundle is already built for the target platform unity won't recompile the shader when building the application so it doesn't contain necessary shader code for single-pass stereo.

So now because in the project the asset bundle was built in multi-view wasn't enabled,the shader was apparently not compiled to support single-pass stereo.

So basically the solution is to have multiview enabled (and the correct graphic API enabled) in whatever project the assetbundles are built in.

Also in case this is relevant for anyone else when building for android theres different macros for the shaders, not the one I have in my original question.

https://docs.unity3d.com/Manual/Android-SinglePassStereoRendering.html

However - I'm surprised by this behaviour, because I did set "Instancing Variants" in Project Settings -> Graphics -> Shader Stripping to "Keep All" in the project in which I'm building the asset bundles. I was under the assumption that this exactly should prevent that the shader code required for single-pass stereo would be stripped out (https://docs.unity3d.com/Manual/class-GraphicsSettings.html). Is this a bug or is this a different class of shader stripping which can currently not be controlled in Unity?

Is this worthy of a bug report or is this intended behaviour?

Comment
Add comment · Show 1 · 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
avatar image JoelPGarcia · May 06, 2021 at 05:39 PM 0
Share

I just spent 5 hours trying to figure out why my asset bundles weren't appearing in builds, but were clearly there because the overhead map cam was rendering them... When I finally figured out that the issue was tied to Multiview, your post popped up and gave my life meaning again. You are an absolute legend.

avatar image
0

Answer by spatialwb · May 29 at 03:20 AM

We had a similar issue, and it turned out that our AndroidMobile build and Meta Quest (Oculus) builds were using the same addressable catalog.

By default the catalog naming is done with a hash (a hash of all the bundles that are contained in the catalog), but we opted for a more human readable name for us, which resulted in two separate builds writing to the same catalog json file.

We resolved it by making the catalog name unique per target platform.

 /Android/catalog_6.19.1.47468.json -> /Android/catalog_6.19.1.47468_MetaQuest.json
 /Android/catalog_6.19.1.47468.json -> /Android/catalog_6.19.1.47468_AndroidMobile.json

TLDR: our Quest app was sometimes loading AndroidMobile bundles, and our AndroidMobile app was sometimes loading Quest bundles.

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

178 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

Related Questions

[Oculus Rift] AvatarSurfaceShaderSelfOcluding.shader will not import 0 Answers

Fallback shaders not working in Asset Bundle? 0 Answers

Oculus rendeing bug 0 Answers

Shader/Material not displaying properly when attached model loaded from bundle 0 Answers

Asset Bundle breaks Materials 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