Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by KristofferH · Jul 14, 2018 at 05:00 PM · shaderscompile-errorgles

OpenGLES3 fails to compile shaders Hidden/Post FX/ for Android in Unity 2018.2

I'm trying out Unity 2018.2 with the LW VR preset setup for my Gear VR (2017) on my Samsung Galaxy S9+ (Android Oreo 8.0.0). But when I try to build for Android it fails to compile some shaders.

I get messages like this:

 Shader error in 'Hidden/Post FX/Fog': undeclared identifier 'sampler_CameraDepthTexture' at line 63 (on gles3)
 
 Compiling Vertex program with STEREO_MULTIVIEW_ON
 Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_DLDR_ENCODING

I also get similar messages for:

 Shader error in 'Hidden/Post FX/Screen Space Reflection': undeclared identifier 'sampler_CameraDepthTexture' at line 129 (on gles3)

 Shader error in 'Hidden/Post FX/Motion Blur': undeclared identifier 'sampler_CameraDepthTexture' at Assets/PostProcessing/Resources/Shaders/MotionBlur.cginc(90) (on gles3)

 Shader error in 'Hidden/Post FX/Uber Shader': undeclared identifier 'sampler_CameraDepthTexture' at line 190 (on gles3)

 Shader error in 'Hidden/Post FX/Depth Of Field': undeclared identifier 'sampler_CameraDepthTexture' at Assets/PostProcessing/Resources/Shaders/DepthOfField.cginc(81) (on gles3)

 Shader error in 'Hidden/Post FX/Ambient Occlusion': undeclared identifier 'sampler_CameraDepthTexture' at Assets/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc(106) (on gles3)

 Shader error in 'Hidden/Post FX/Temporal Anti-aliasing': undeclared identifier 'sampler_CameraDepthTexture' at Assets/PostProcessing/Resources/Shaders/TAA.cginc(70) (on gles3)

It also outputs this:

 UnityEditor.BuildPlayerWindow+BuildMethodException: 8 errors
   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:187 
   at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:94 
 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

If I remove OpenGLES3 and only build using Vulkan the shaders compiles but then the per eye rendering and rotation tracking does not work, but that's another issue.

Any ideas of how to fix these shader errors?

Comment
Add comment · Show 2
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 hexagonius · Jul 14, 2018 at 05:17 PM 0
Share

not really cause they're unity internal shaders. I'd file that as a bug report.

avatar image KristofferH hexagonius · Jul 14, 2018 at 07:18 PM 0
Share

I've filed a bug report, let's hope they can fix it soon! :)

2 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by mckinnonCT · Oct 05, 2018 at 05:14 PM

I found an answer that worked for me here https://issuetracker.unity3d.com/issues/gearvr-singlepassstereo-image-effects-are-not-rendering-properly

As Arkade says, to fix any shader with this problem, swap the declaration of the sampler from:

uniform sampler2D_float _CameraDepthTexture;

to

UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);

Comment
Add comment · Show 3 · 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 skullthug · Mar 07, 2019 at 09:02 AM 0
Share

Thanks, this appears to have worked for my situation with the Oculus Go & Unity 2018.3.6f1

avatar image salma_unity986 · Jul 18, 2019 at 10:37 AM 0
Share

How did u excatly solve this ?can u please explain in detail , in my case i couldn't first code snippet you were mentioning

avatar image mckinnonCT salma_unity986 · Jul 19, 2019 at 06:07 PM 0
Share

So, in my case, these shader errors are found in the Post Processing shader pack. So look in Assets > Post Processing > Resources > Shaders. I had several scripts with this error, like AmbientOcclusion.cginc, Fog.shader, and $$anonymous$$otionBlur.cginc for example. Just open up whichever scripts are causing errors (or just search for sampler2D_float), look for a line with "sampler2D_float _CameraDepthTexture;" and replace those lines with UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);

avatar image
0

Answer by nonstop99 · Mar 18, 2021 at 03:47 PM

I had this error too. I just searched for post processing on the project manager (where you view your assets) and then deleted the post processing folder.

I think I must have imported an asset pack that contained some post processing scripts. I don't think these are needed for VR?

Anyway I deleted all the post processing stuff and i managed to build my apk without any errors.

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

99 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

Related Questions

No acceptable conversion when converting cg shader to glsl 0 Answers

Add transparency to sprite shader with cast shadows and receive shadows and lighting 2 Answers

Shader For cut hole and alpha blend 1 Answer

Is it possible to pair an animated normal map image sequence to a diffuse sprite sequence? 1 Answer

Shader Animation (and PerRendererData) 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