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
0
Question by Doctor-Nitros · Dec 11, 2015 at 01:52 PM · errorshadercompilationgles

Need help with shader not working!

Hello everyone

I was trying to compile and modify Car Paint shader for android (probably want to run it on PC too) But I'm facing a strange problem - It just won't work

When I tried it in Unity 4.5 It all went purple and said that shader has errors or is not supported by my graphics card. it also said that no subshaders can run on this videocard. (seriously? I never had any problems like that and I have a powerful enough PC that's for sure)

Then I tested inin Unity 5 and...It's just not working. It does not tells me if there are any errors and doesn't seem to compile it. I get black material and none of the changes are giving any effect to it.

there's the shader

 Shader "TEST/Car_Paint" {
 Properties {
  _kMetallicCoverage ("Metallic Coverage", Range(0,0)) = 0
  _kMetallicShininess ("Metallic Shininess", Range(0,0)) = 0
  _kClearCoatF0 ("Clear Coat Specular Intensity (f0)", Range(0,0)) = 0
  _kClearCoatShininess ("Clear Coat Shininess", Range(0,0)) = 0
  _kFresnelPower ("Fresnel Power", Range(1,1)) = 0
  _kMetallicBoost ("Metallic Colour Boost", Range(1,1)) = 0
  _kDiffuseTint ("Diffuse Tint (RGB)", Color) = (0,0,0,0)
  _kMetallicTint ("Metallic Tint (RGB)", Color) = (0,0,0,0)
  _kLiveryUVScale ("Livery UV Scale", Range(0.5,0.5)) = 0
  _MainTex ("UV0 Livery Albedo_RGB", 2D) = "defaulttexture" {}
  _AuxTex1 ("UV0 Livery F0_R Shiny_G Opacity_B", 2D) = "defaulttexture" {}
  _DiffAmbientMap ("Diff Ambient Map", CUBE) = "defaulttexture" {}
  _SpecAmbientMap ("Spec Ambient Map", CUBE) = "defaulttexture" {}
  _SpecLoopAmbientMap ("Spec Loop Ambient Map", CUBE) = "defaulttexture" {}
 }
 SubShader { 
  Pass {
   Tags { "RenderType"="Opaque" }
 Program "vp" {
 SubProgram "gles " {
 "!!GLES
 
 
 #ifdef VERTEX
 
 attribute vec4 _glesVertex;
 attribute vec4 _glesColor;
 attribute vec3 _glesNormal;
 attribute vec4 _glesMultiTexCoord0;
 void main ()
 {
   highp vec4 tmpvar_1;
   tmpvar_1.w = 0.0;
   tmpvar_1.xyz = normalize(_glesNormal);
   gl_Position = (((_glesVertex + tmpvar_1) + _glesColor) + _glesMultiTexCoord0);
 }
 
 
 
 #endif
 #ifdef FRAGMENT
 
 void main ()
 {
   gl_FragData[0] = vec4(1.0, 1.0, 1.0, 1.0);
 }
 
 
 
 #endif"
 }
 SubProgram "gles3 " {
 "!!GLES3#version 300 es
 
 
 #ifdef VERTEX
 
 
 in vec4 _glesVertex;
 in vec4 _glesColor;
 in vec3 _glesNormal;
 in vec4 _glesMultiTexCoord0;
 void main ()
 {
   highp vec4 tmpvar_1;
   tmpvar_1.w = 0.0;
   tmpvar_1.xyz = normalize(_glesNormal);
   gl_Position = (((_glesVertex + tmpvar_1) + _glesColor) + _glesMultiTexCoord0);
 }
 
 
 
 #endif
 #ifdef FRAGMENT
 
 
 layout(location=0) out mediump vec4 _glesFragData[4];
 void main ()
 {
   _glesFragData[0] = vec4(1.0, 1.0, 1.0, 1.0);
 }
 
 
 
 #endif"
 }
 }
 Program "fp" {
 SubProgram "gles " {
 "!!GLES"
 }
 SubProgram "gles3 " {
 "!!GLES3"
 }
 }
  }
 }
 Fallback "Diffuse"
 }


I hope someone could help me with this problem,I searched a lot but didn't found any working way to fix it...

I am currently using monodevelop 4.0.1 and Free copy of Unity 5

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

Answer by Hyper00 · Dec 13, 2015 at 02:57 PM

ifdef VERTEX //начало Вершинный шейдер

void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; //ftransform(); } #endif //Вершинный шейдер - Конец

посмотри сам вершинный шейдер под OpenGL работает отлично! Но не будет работать он под Андроид)))) я как раз столкнулся с обратной проблемой! ты кстати мне помог... спасибо тебе большое)))

gl_Vertex = attribute vec4 _glesVertex; проблема что в опенГЛ нужен gl_Vertex для ПК

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
avatar image
0

Answer by tanoshimi · Dec 11, 2015 at 02:04 PM

Your shader only has GLES subshader (see where it says subprogram "gles"). So are you running Unity in OpenGL mode? If not, no subshaders can run on this videocard, which is pretty much what the error told you.

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 Doctor-Nitros · Dec 11, 2015 at 02:12 PM 0
Share

I've heard that I need to write -force-opengl in the comment section of the unity shortcut but I think that it's not running on the OpenGL.

Should I run Unity trought the C$$anonymous$$D ins$$anonymous$$d? And how is it going to effect on my future builds? [UPDATE]

Just tried Running Unity 5 in OpenGL. No effect and no errors. Wha does it means? It doesn't tell me about Videocard in Unity5 Just found one more detail. It says thet it's a precompiled shader and it does not have compiled codealt text

t343.png (248.6 kB)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

[Solved] False "variable not assigned" error 3 Answers

jungle terrain problem 0 Answers

Shader Error GLSL error 0 Answers

CG shader is treated as GLSL and doesn't compile 0 Answers

I have error in Shader transparent/Refractive 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