Search Unity

I need help in modifying this shader.

Discussion in 'Shaders' started by Gekigengar, Oct 17, 2014.

  1. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    439
    Below is a shader I have created using Strumpy, combined with my close to nothing knowledge of mixing shaders using Mono.

    I know its terrible, as you should consider it to be my first try.

    The occlusion does not work, as I don't know how to make it interact as a shadow with light.

    I have attached both the texture and the shader. (Both are made by me.)
    I don't have any experience in programming, and I am more into creating assets.

    (Texture)
    https://www.mediafire.com/?a8266s52u606yr4

    So first..

    I need help in 3 things.

    1. Why do the specular does does not work when there is no normal?
    2. I need a version of this shader, with removed Parallax, fail Occlusion, and Normal map. (I added the parallax and occlusion manually, I can remove them, but its different with removing normals, it kept giving me weird errors.)
    3. I need the fail occlusion to work with light like a shadow would! (Texture gets invisible partially (probably alpha) on position it came in contact with light with.)

    Thank you for taking the time to read,
    I hope somebody out there can teach me a thing or two from my errors.

    I believe, every mistake is a lesson.
    But a mistake without an answer is a halt of progression.

    Hence is why teachers and seniors exist.
     

    Attached Files:

  2. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    430
    Code for specular is basically pow(dot(normal, light)), gloss. So for specular you have to have normals to work. Same with diffuse and other lighting equations. There is no other way to get specular without normals, well maybe you can but that would require a lot of work to do or not many work to do depending on what kind it is. I wish i had to time to help you but i can only help you with one thing for now which is this comment for your first question.
     
  3. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    439
    Thank you for the kind reply.

    I appreciate your saintly intentions.

    I will be waiting for the answer,

    Please, take your time.
     
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    439
    Any help anyone..?
     
  5. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,109
    I'm not good but there is a good unity 4 shader book. I try it and you get a good level knowledge.
    Unity 5 will help you!
     
    Gekigengar likes this.
  6. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    439
    Do you have any link to that book?
    Is the book specifically written for Unity?
    If so, then, I will definitely do a purchase!
     
  7. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,109
    Googleit: unity shader and effects book in amazon or better pucktpub: there is a nice cut off the 80% prize this days.
     
  8. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    439
    Unity Shaders and Effects Cookbook by Kenny Lammers correct?
     
  9. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,109
    Yes, Probably, I do not remember now the name of the autor. There is only one on this subject.
    You can read the introduction first 2 chapters and look there are more youtube video of the same autor as well.
    Youtube is grate place for looking tutorials of a specific subject. About shaders there is a big section in Unity wiki.
    http://wiki.unity3d.com/index.php/Shaders
     
unityunity