system
1
hello, i am pretty new to unity shaders, and i have a few questions.
is it true that shader code is always written in CG? there is now way to code in HLSL or GLSLS?
how do i provide additional data from the application to the shader input? i.e. i see v2f vert (appdata_base v)
but how can i extends the appdata_base to access stuff like texture coords?
once i have written the shader code? how do i refresh it in the view? i.e. how do i retrigger a compilation of the shader and where can i see its error?
thanks
efge
2
-
Yes and no :-) More information is in the docs.
Shaders in Unity: Shaders
GLSL (not recommended): GLSL Shader Programs
Cg/HLSL (yes): Writing vertex and fragment shaders
Define a property in your shader and use SetFloat to access it by script.
-
The same way as with scripts: Errors are displayed in the console window.
(Make sure “auto refresh” in the preferences is on.)
There are some great ShaderLab tutorial videos on YouTube: http://www.youtube.com/user/JessyUV