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 Hoeloe · Feb 03, 2014 at 05:47 PM · androidshaderopengl

Shader on Android - Custom .cginc not loading

So, I'm developing a shader, hoping to put it up on the asset store. It's pretty much done, but I thought I'd try it out on Android first, just to make sure it was compatible, and I tried it out. Unfortunately, it came out looking like this:

Lighted area appears solid black

Now, there are a few things that are particularly odd about this. First off, it shows the outline, but not the main body. All of the lighting calculations are in a separate, cginc file, which I'm #including. This is exactly the effect I get when there are compile errors in that file, and having changed it to only display solid white (to check it was an error loading it rather than a calculation error), I still got this effect. What is particularly odd about this, though, is that the left image is running with OpenGL ES 2.0 compatibility active, which means it SHOULD run fine on Android. (Turning on OpenGL ES 1.x does not render correctly, but gives a black object with no outline - not the same effect). The thing is, there isn't anything too odd about the cginc file. It contains one #include itself (specifically #include "UnityCG.glslinc"), and a number of variable declarations (all named with the format: half _Name). It also contains a few inline functions for the lighting calculations.

I cannot understand for the life of me why it seems to fail to load this file correctly. I have tried both relative (`#include ../CG.cginc`) and absolute (`#include Assets/CG.cginc`), but both have given the same result. Some help here would be appreciated.

IMPORTANT EDIT:

I tried removing the function from the .cginc file and putting it straight in the shader, and it didn't fix the issue. Does anyone know what might be causing this?

EDIT AGAIN:

Well, it looks, from the testing I've done, like it's something to do with the instruction count. I have a lot of separate instructions going on here, and cutting out a couple seems to fix it. I'm working on cutting it down now.

anicelerror.png (358.5 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

1 Reply

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

Answer by Hoeloe · Feb 03, 2014 at 07:57 PM

I've sorted this. There was too much calculation, so I've made a slightly trimmed down "Lite" version that will run on mobile.

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

18 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

Related Questions

Uniform variable fails on the android 0 Answers

SkinnedMeshRenderer not being affected by lights with OpenGL ES 1.x 0 Answers

polygon crop an image 0 Answers

Set default number/emails in a new text message/email sent via unity 0 Answers

Shader works in editor but not on Android 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