Search Unity

Shader - level operation using shader forge

Discussion in 'Shaders' started by Elzean, Jul 14, 2014.

  1. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    I followed this post : http://www.alkemi-games.com/a-game-of-tricks-iii-particles-fun-part1/#more-354

    My problem is when i need to create the "level operation" with this formula :
    new_luminosity = saturate ( ( old_luminosity – B ) * S ) ;

    I'm using Shader Forge and i was able to make a simple threshold animation using an "if" node, but i didn't succeed to create the "level operation" that should give smoother edges.

    If someone could help me with that it would be great :)


    Thanks!

     
  2. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Also here is what i came up in Flash, it's not finished and i do not draw the same way they do (from what i understand in the post) but the result should be more or less similar. My animation sucks though XD
    You can play with the settings in flash to come up with different results, you have to use Flash the swf will not work. At the end of the animation flash will propose you to save the result picture as png.

    And this is my actual shader with simple threshold :




    Hope those can help toward finding a solution to my problem :)
     

    Attached Files:

  3. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    So i made an update in the Flash for anyone interest in this kind of effects. You can now use it for the in and out effect, you can follow the example inside the flash. There is some more params to mess with too but overall cleaner code.

    It now generate the "in" effect in blue channel and the "out" in Red channel.

    You end up with that kind of pic :


    I'm still interested in a better shader within Unity :p
     

    Attached Files:

  4. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    here is the texture generated with the last flash tool version




    Thanks to the creators of Drifting lands showing me their shader in detail i was able to create one in Shader Forge, it's not exactly the same to fit what i need but it's easy to tweak





    and the result :





    It's already usefull as it is but does someone know any custom particle engine where i could control the param of the shader for an individual particle ? For example here it would be shaderLife=particleLife so the particle appear and disappear throw the shader effect.

    I think it was possible with UDK using the dynamic parameter in the shader, but i don't think there is a solution with Shuriken in Unity. Playground Particle is based on Shuriken so not much help here and Xffect i'm not sure as i don't understand well the code inside.

    So if someone have any idea on how to use it with particles it would be great else i will just stick with normal objects...
     

    Attached Files:

  5. Nichtsein

    Nichtsein

    Joined:
    Jan 15, 2014
    Posts:
    1
    I have been having the same issue. There are no clear ways to hook up shaders made in shader forge to Shuriken. I have seen some try to hack they way through it by using a vertex color node that drives dynamic perimeters, but I have encountered a wall because even though you can use color channels to drive aspects of your shader it doesn't seem like there is a way to tell shurken to negate the vertex information. Has anyone found any ways of getting around this? These issues just point out how limited Unity's particle system really is.