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 Chiri · Jun 20, 2013 at 05:53 PM · androidshaders

Shaders: OpenGL ES 2.0 surface program?

Hey all,

We recently released a game and as such we found that an android device wasn't rendering correctly. After some research we uncommented a line that was pragma exclude_renderers gles

and above that was

// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it

// does not contain a surface program or both vertex and fragment programs.

after more research i could not figure out why it wont work on a specific device, and what does the surface program has to do with it not working on it.

it works on that device if i uncomment the exclude but it just uses the fallback.

so does anyone know what does it mean that OpenGl ES has no surface/vertex/fragment programs, being that it works on most Android devices?

Comment
Add comment · Show 1
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 equalsequals · Jun 20, 2013 at 07:33 PM 0
Share

It would be beneficial to post the shader's source code.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Chiri · Jun 20, 2013 at 08:24 PM

The following is the shader Code.

 // MatCap Shader, (c) 2013 Jean Moreno
 
 Shader "MatCap/Vertex/Textured Lit"
 {
     Properties
     {
         _Color ("Color", Color) = (1,1,1,1)
         _MainTex ("Base (RGB)", 2D) = "white" {}
         _MatCap ("MatCap (RGB)", 2D) = "white" {}
     }
     
     SubShader
     {
         Tags { "RenderType"="Opaque" }
         LOD 300
         
         CGPROGRAM
 
         // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
         #pragma exclude_renderers gles
         #pragma surface surf Lambert vertex:vert
         
         sampler2D _MainTex;
         sampler2D _MatCap;
         float4 _Color;
     
         struct Input
         {
             half2 uv_MainTex : TEXCOORD0;
             float2 matcapUV;
         };
 
         void vert (inout appdata_full v, out Input o)
         {
             o.matcapUV = float2(dot(UNITY_MATRIX_IT_MV[0].xyz,v.normal),dot(UNITY_MATRIX_IT_MV[1].xyz,v.normal)) * 0.5 + 0.5;
         }
         
         void surf (Input IN, inout SurfaceOutput o)
         {
             half4 c = tex2D(_MainTex, IN.uv_MainTex);
             half4 mc = tex2D(_MatCap, IN.matcapUV);
             o.Albedo = c.rgb * mc * _Color * 2.0;
         }
         ENDCG
     }
     
     Fallback "Diffuse Detail"
 }
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 Chiri · Jun 21, 2013 at 07:56 PM 0
Share

Ok figured it out, The first part refers to it ignoring OpenGl ES and forcing it to go back to the fallback shader on a platform that uses that $$anonymous$$odel.

The second part was requesting that the $$anonymous$$imum functions required to work if i used a Surface shader or a vertex shader.

I still have the problem so i will do a follow up question for the actual issue why this is not working.

avatar image equalsequals · Jun 21, 2013 at 09:10 PM 0
Share

If the problem is you are running into an instruction limit, try forcing Shader$$anonymous$$odel 3 #pragma target 3.0 or forcing GLSL conversion #pragma glsl which may help. Source documentation here.

avatar image Chiri · Jun 21, 2013 at 10:09 PM 0
Share

How would i know if im running into an instruction limit?

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

15 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

Related Questions

how to enable Compute shaders for OpenGL ES 3.X in Unity 5.1.x? 1 Answer

GUI and Shader problem on specific Android devices (HTC ONE X) 0 Answers

Standart(roughness setup) to Autodesk Interactive Issue 0 Answers

Android Export, Screen Flashes From Shaders 0 Answers

Strumpy Shader Editor for Mobile? 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