Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

CG shader is treated as GLSL and doesn't compile

$
0
0
Hi, I need a shader to support vertex colors, so I followed this tutorial here: [http://en.wikibooks.org/wiki/Cg_Programming/Unity/Smooth_Specular_Highlights][1] and made the modifications so it showed the vertex color. I also added Texture sampling. The shader was created and tested in a different project/scene I need it in, just to have a clean work environment. There it works as I want it to. Creating a new shader in my real project and copypasting the shader's code into the newly created shader, results in errors during shader compilation, such as: > "Material doesn't have a texture property '_MainTex'"> "GLSL vertex shader: 73: ERROR: '' unsupported construction at line 13" *(that's where "CGPROGRAM" is written in the shader's code)* The second error message suggests that the shader is being compiled by a GLSL-compiler and not a CG-compiler. Is there a way to set the type of shader explicitly to CG so Unity does not try to compile it as GLSL? I have also tried to copypaste the unmodified tutorial code above into the shader, but the GLSL error persists. [1]: http://en.wikibooks.org/wiki/Cg_Programming/Unity/Smooth_Specular_Highlights

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>