Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 ratking · Jan 16, 2014 at 10:55 AM · shaderwarningsssaoimage effect

Several shader warnings with Unity's SSAO image effect

I have a problem with Unity's SSAO shader. I get the following warnings:

Shader warning in 'Hidden/SSAO': GLSL vertex shader: 335: ERROR: ']' : syntax error parse error at line 60

Shader warning in 'Hidden/SSAO': GLSL vertex shader: 335: ERROR: ']' : syntax error parse error at line 89

Shader warning in 'Hidden/SSAO': GLSL vertex shader: 335: ERROR: ']' : syntax error parse error at line 124

Shader warning in 'Hidden/SSAO': GLSL vertex shader: 335: ERROR: ']' : syntax error parse error at line 170

Shader warning in 'Hidden/SSAO': GLSL vertex shader: 335: ERROR: ']' : syntax error parse error at line 243

These warnings appear whenever I have a camera with the SSAO image effect attached and create/edit another shader. What could be the problem, and how to solve it?

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

1 Reply

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

Answer by Geeoff · Feb 24, 2014 at 08:11 PM

Not sure if this is the best solution but it works well for me. If you look towards the top of SSAOShader.shader, you will see:

 #ifdef UNITY_COMPILER_HLSL
 
 #    define INPUT_SAMPLE_COUNT 8
 #    include "frag_ao.cginc"
 
 #    define INPUT_SAMPLE_COUNT 14
 #    include "frag_ao.cginc"
 
 #    define INPUT_SAMPLE_COUNT 26
 #    include "frag_ao.cginc"
 
 #    define INPUT_SAMPLE_COUNT 34
 #    include "frag_ao.cginc"
 
 #else
 #    define INPUT_SAMPLE_COUNT
 #    include "frag_ao.cginc"
 #endif

That's the offending code. It's shared with all the passes below. For HLSL it defines the function frag_ao multiple times with different sample counts. For GLSL it just leaves the sample count blank. GLSL seems to not like this. My fix was to break this up and move it into the passes that needed it. So for example my first pass looks like this:

     // ---- SSAO pass, 8 samples
     Pass {
         
 CGPROGRAM
 #pragma vertex vert_ao
 #pragma fragment frag
 #pragma target 3.0
 #pragma fragmentoption ARB_precision_hint_fastest
 
 #define INPUT_SAMPLE_COUNT 8
 #include "frag_ao.cginc"
 
 half4 frag (v2f_ao i) : COLOR
 {
     #define SAMPLE_COUNT 8
     const float3 RAND_SAMPLES[SAMPLE_COUNT] = {
         float3(0.01305719,0.5872321,-0.119337),
         float3(0.3230782,0.02207272,-0.4188725),
         float3(-0.310725,-0.191367,0.05613686),
         float3(-0.4796457,0.09398766,-0.5802653),
         float3(0.1399992,-0.3357702,0.5596789),
         float3(-0.2484578,0.2555322,0.3489439),
         float3(0.1871898,-0.702764,-0.2317479),
         float3(0.8849149,0.2842076,0.368524),
     };
     return frag_ao (i, SAMPLE_COUNT, RAND_SAMPLES);
 }
 ENDCG
 
     }

No more complaints! Hope this helps!

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

20 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

Related Questions

Depth buffer access via GLSL shaders 0 Answers

Trying to use GBuffer RT0 and only get a grey screen. 1 Answer

Shaders and ambient occlusion 1 Answer

Desaturating based on camera depth in an image effect? 0 Answers

This shader (or Image Effect) is not working on Android 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