Search Unity

Is ther any shder tutorial for unity5,from basic setup?

Discussion in 'Shaders' started by KILEYI, Mar 26, 2015.

  1. KILEYI

    KILEYI

    Joined:
    Mar 7, 2015
    Posts:
    52
    new to unity5,i read some shader tutorial called Cg Programming in Unity which works for unity4,but not unity5.
    guess unity5 change some basic shder route.
    what i mean is the vert and frag function does not work directly as unity4,so where can i find some beginner tutorial shader tutorial for unity5?not surface shader,just traditional cg programming for unity5
     
  2. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    I would start by recommending the docs : http://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html here you can find some info on vert/frag shader (search for "Simple Shader" for the actual start of example using vert/frag, all before is just setup)

    After that it's "simply" shader programming, so any tutorial online could help. Just remember that Unity will fill input structure for you, see this for list & how to use them : http://docs.unity3d.com/Manual/SL-VertexProgramInputs.html (lots of other examples here)
     
  3. KILEYI

    KILEYI

    Joined:
    Mar 7, 2015
    Posts:
    52
    yes,i have read that example from unity4,but it does not seem to work in unity5.
    when i drag the shader,let's say this one
    http://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html
    Shader "Custom/SolidColor"
    drag this shader into material,it says
    ArgumentException: Could not find MaterialProperty: '_Mode', Num properties: 0

    that's why i post this thread,cause what's working in unity4 does not work in unity5

    so,i wonder if there is some shader tutorial for unity5 from ground up
     
  4. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    You actually may have found a bug. =D!

    The shader seems to properly be set and work fine, but an error is spam in the log indeed.

    Instead of drag'n droping the shader, select it in the menu (with your material selected, under the material name, clic on the dropbox, and find your custom shader, in this case Custom/SolidColor). The error shouldn't appear anymore.
     
  5. KILEYI

    KILEYI

    Joined:
    Mar 7, 2015
    Posts:
    52
    no fxxking way,i thought they change the shader route,and now it turns out it is a bug.:eek:
    is this some bad habit for me always drag shader to material and didn't find it out,out of my mind...
    anyway,thank you very much dude,really help.finally i can use some my old shader in unity5