Search Unity

How to customize Standard shader ?

Discussion in 'Shaders' started by chai, Jan 1, 2016.

  1. chai

    chai

    Joined:
    Jun 3, 2009
    Posts:
    84
    I want a standard shader with parallax, with exposed vert/frag/surf functions where I can add my own stuff (e.g. vertex blending, unique effects, etc)

    1. I created a new standard shader within unity, there was no reference to parallax there

    2. I downloaded the bundled shaders source code.
    All I see are includes & #pragama shader_features (controlled via custom gui)
    There are no vert/frag/surf functions where I can edit stuff.

    3. I bought some shaders from the store, they all seem to use this new all-in-one design like unity standard shader, again with no place to customize things :(

    Am totally lost here and can't find any documentation regarding customizing the new shaders whatsoever.
     
  2. a_p_u_r_o

    a_p_u_r_o

    Joined:
    May 27, 2015
    Posts:
    23
  3. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    I've customized the standard shader using among others my own parallax code. Instead of UnityStandardCore.cginc I use my own include, but I do rely on the other standard includes where possible. So it's not needed to make your own version of every standard include file.

    Still, it's a pretty big task and my own standard shader does use 10 custom include files. Mainly for fairly simple things like brdf calculations.
     
  4. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    It's a bit fiddly but it can be done. Mostly you just need to dig out the various methods that are used.

    I've managed to do it (set up translucent and flow mapped variants).

    By and large it's a lot easier to create duplicates of the affected includes, strip them down to only include the methods you're altering. Then you can include the default ones and your own (and then use your own methods, which are probably the same as the default ones but renamed a bit).

    That should keep the code reuse as best you can.
     
    Brad-Newman likes this.
  5. chai

    chai

    Joined:
    Jun 3, 2009
    Posts:
    84
    Cheers, managed to create my own variant !

    So much slower than the good ol abstracted vert/frag/surf shader though.
    Worst part is having to reimport materials manually (to force recompile), surely there is a better way ?