Search Unity

The last of us zombie shader effect

Discussion in 'General Discussion' started by wendymorrison, Oct 24, 2016.

  1. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Hi i was wondering if there is a shader out there to buy or somethink that can do a zombie effect like the last of us. I have done press down button to get an shader in playmaker because still don't know how to code. I have tried the ghost shader which is half what i want meaning i don't really want the body be invisible but i do want the nice outline effect and where you can see them behind the wall. I am just wondering if maybe there was an asset on the asset store i overlooked or if someone could make me a tutorial so i can learn this. Thanks in advance.
     
    zombiegorilla likes this.
  2. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
  3. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
  4. Pagi

    Pagi

    Joined:
    Dec 18, 2015
    Posts:
    132
    Other videos from this guy are really great too. There are not many tutorials on shaders, and this one is so well done even beginner can learn from it. Really deepened my understanding of the basics, hope he makes more.
     
    JamesArndt likes this.
  5. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Thanks for answers but i did not understand any of that video and this shader uses a camera so it may not work with a click of a button. I really don't think that video is for an absolutly beginner sorry but thanks any way. I will try that link considering it is not a fast run through.
     
  6. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    I did try the x-ray from that link but i have no camera shader replacement script.
     
  7. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    sorry for posting again but i looked closer at the video and i didn't really want xray either. I actually needed a outline glow effect that is bright like the one in the video but should be able to see the enemy upon button pressed down behind a wall. I still want the textures seeable though. Sorry for not explaining things better but hopefully the image may clarify things. I thought i might find one but it is actually harder than it looks. The ghost shader does work great still but if the zombie is not behind a wall and you still hold the button down its just invisible. I don't mind if you can't see the textures behind the wall except for the glow but when not behind the wall i need to see the textures plus the nice glow effect. In that video he speaks about having the glow overlay the character so you can still see the textures but i noticed the textures are not visible behind the wall except for the glow, i need the whole character to be visible behind the wall or if i can't do that have it when behind the wall it has a white glow on top of black like a siliquette and then if not behind wall the siliquette gets replaced with a normal shader but with a white glow as long as you hold the button down and when you let the button go the shader goes back to the normal material. Sorry for long post hopefully someone can understand but thank you anyway.
     

    Attached Files:

  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Shader Forge lets you build shaders visually the same way playmaker works for scripts. Have you tried that out?

    Otherwise your best bet is to learn how to write a shader yourself.
     
  9. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    I am going to get shader forge because the ghost shader is made with that and i can open it with shader forge so maybe i could edit it or do another. I did try the above shader but the outline one but its similar to the ghost shader i have. I did do this one but its not real good:
    Shader "Custom/Effects/ItemGlow1"
    {
    Properties
    {
    _ColorTint("Color Tint", Color) = (1, 1, 1, 1)
    _MainTex("Albedo (RGB)", 2D) = "white" {}
    _BumpMap("Normal Map", 2D) = "bump" {}
    //_Glossiness("Smoothness", Range(0,1)) = 0.5
    //_Metallic("Metallic", Range(0,1)) = 0.0
    _RimColor("Rim Color", Color) = (1, 1, 1, 1)
    _RimPower("Rim Power", Range(1.0, 6.0)) = 3.0
    }


    SubShader
    {
    Stencil
    {
    Ref 0
    Comp NotEqual
    }

    Tags{ "Queue" = "Overlay" "RenderType" = "Opaque" } // modified
    ZWrite Off
    ZTest Always // this line is added
    //Blend One One
    LOD 200

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Standard fullforwardshadows

    // Use shader model 3.0 target, to get nicer looking lighting
    #pragma target 3.0

    struct Input
    {
    float4 color : Color;
    float2 uv_MainTex;
    float2 uv_BumpMap;
    float2 uv_SpecularMap;
    float3 viewDir;
    };

    //half _Glossiness;
    //half _Metallic;
    float4 _ColorTint;
    sampler2D _MainTex;
    sampler2D _BumpMap;
    float4 _RimColor;
    float _RimPower;

    void surf(Input IN, inout SurfaceOutputStandard o)
    {
    IN.color = _ColorTint;
    o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb * IN.color;
    o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
    half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
    o.Emission = _RimColor.rgb * pow(rim, _RimPower);
    //o.Metallic = _Metallic;
    //o.Smoothness = _Glossiness;
    }
    ENDCG
    }
    FallBack "Diffuse"
    }
    But like i said i don't know how to code at all. I did get a ebook unity 5x shaders and effects, i am going to read it and learn that until i get shaderforge.
     
  10. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    About the see through shader effect....

    I have created such a shader a while ago, and posted a thread about it containing the code. Its is a quite involved system and a little bit expensive, but if you wouldn't need the deferred rendering, you could make it much cheaper and slimmer.
    I had to duplicate the static objects because I needed an additional shader for it. In forward you could integrate everything into a single multipass shader.

    https://forum.unity3d.com/threads/s...-the-deferred-renderer-and-speedtrees.430207/
     
  11. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Hi i only can this far at the moment see pics. This is similar what i wanted. The above post shaders won't work for me by the way.
     

    Attached Files:

  12. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    While I don't want to discourage anyone from learning to program, if you don't already know how to program, shaders are probably not a good place to start. They have a lot of weird rules and requirements, they have a lot of restrictions and limitations because of the way the graphics card works, the language has a lot of inconsistencies, and generally there is no way to interactively debug them.

    Learn C# first.

    Which won't help you with your problem, but maybe it'll keep you from getting discouraged.
     
    Billy4184, gian-reto-alig and Kiwasi like this.
  13. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Yeah what i really wanted is a asset to buy, i didn't really want to learn it really because me and coding do not mix because i just don't get it, thats the reason why i was actually using playmaker. I think i will only use the one i posted up top here or just use the normal ghost shader. At least until i get shaderforge. Thankyou everyone for trying to help.
     
  14. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I just wanted to warn you that shaderforge only removes a part of the complexity of customizing shaders. I have SF and a) there are shaders that I could hack together manually but that can't be made with SF due to technical limitations, and b) I tap into mostly the same kind of knowledge when making a shader with SF as I would when messing around with shader code directly. You still need to understand how to use math to make things look the way you want them to look, that doesn't get that much easier if you build that math with nodes instead of code.
    Just look at a few screenshot of example node setups and at the documentation to see if you can make sense of it.
     
  15. FreeFly90

    FreeFly90

    Joined:
    May 28, 2016
    Posts:
    177
    Martin_H likes this.
  16. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,128
    Just keep in mind that Shader Forge won't magically make you capable of creating shaders. Unlike PlayMaker which does abstract away many of the coding aspects, Shader Forge is simply representing the code as visual nodes rather than in a text form. You still need an understanding of shader coding to make use of it.
     
  17. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Like when I was 10 years old and realized this thing wasn't a shortcut to making my own electronic gadgetry.

    1.jpg
     
    Ryiah likes this.
  18. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    This. I got sf a long time ago, and barely used it. Once I really got into shader writing, and understood it, sf became very useful. I have yet to use something from sf without a fair amount of manual editing, but it really makes the process much faster.
     
    Ryiah and Kiwasi like this.
  19. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,128
    About the only electronics kit that I was able to get any real mileage out of was the Radioshack 300-in-1 that came with a breadboard. Getting new functionality was as easy as picking up new ICs like an Atmel microcontroller. I don't recall if I ever made more than a handful of the official projects it described. Most of the time I used third party learning resources.

    The kit itself is still available for sale through a different company which shows just how successful it was.

    https://www.amazon.com/Elenco-300-in-One-Electronic-Project-Lab/dp/B00005K86O

    717cL9JZ67S._SL1200_.jpg
     
    Last edited: Oct 25, 2016
  20. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    To support what others have said, shaderforge is a good way to hack together your shader that SLIGHTLY deviates from the cookie cutter standart ones. Need a self-illuminating shader that pulsates? shaderforge got you covered (so do other high quality paid shaders, which gives you this option out-of-the-box, like UBER.... ).

    If you want to create something ubercomplex, that breaks the rules of what is normally possible in the renderer of your choosing, like a see through shader in the deferred renderer that is NOT always drawn on top of everything, shaderforge alone is not helping you much.

    You will need a deeper understanding for example of the stencil buffer, the way the deferred renderer "abuses" the stencil buffer, how you can set up an alternative shader system rendered in the forward phase, how to clear the stencil buffer after the deferred phase, and so on, and so forth.
    There might be other ways to make it work, but they are just as involved (Rendertargets and whatnot).

    Long story short, a see through shader that isn't just a simple overlay drawn on top of everything (in which case its a simple render order problem, which shaderforge should have covered) is a very complex shader that needs to alter the way rendering usually works. You are basically "working around" the fixed pipeline of the renderer, you need to save away information that usually gets lost during context switches of the GPU.
    Hence why its something that needs A LOT of special code. Hence MOST PROBABLY shaderforge will not offer enough options to do it (might be wrong here, but when I checked out shaderforge haven't seen any options for writing/reading to/from the stencil buffer, or setting up renderTargets).


    This is also why I shared my rather hacky solution, and why some guy might ask for some cash if he comes up with a more elegant solution in the asset store. Its actually not straight forward and quite a lot of work to do.


    You said my shader won't work for you. Why? Is there a problem with it? Not using the deferred renderer? Tried it and it didn't work?
     
    Kiwasi, Ryiah, MV10 and 1 other person like this.
  21. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Careful with mobile and stencil buffer. Unity already overuse it and I had to replace the UI shader with a custom one everywhere as it is seriously affecting performance on low end mobile GPU.
     
    gian-reto-alig likes this.
  22. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Way to kill my illusion guys. I was just about to buy shader forge to solve all my graphics problems for me. Of course by just about I mean sometime on the next six months. And by buy I mean wistfully watch a YouTube video on it.

    I guess I'll just have to learn shaders the hard way. Which I'll probably get to quicker then I would shader forge.
     
    gian-reto-alig and MV10 like this.
  23. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,128
    After which Unity will officially announce they're releasing their own visual material editor. :p
     
    MV10 likes this.
  24. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Shhh! I'm having flash backs to learning OnGUI. I had just mastered the intermediate mode GUI when 4.6 was released.

    I can't complain too much, I've made a fair bit of pocket money off of the UI system.
     
    Last edited: Oct 27, 2016