hello, i am pretty new to unity shaders, and i have a few questions.

  1. is it true that shader code is always written in CG? there is now way to code in HLSL or GLSLS?

  2. 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?

  3. 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

  1. 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

  2. Define a property in your shader and use SetFloat to access it by script.

  3. 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