Deferred unlit shader.

Hello, guys. I am working on some nature environment and i need a decent grass.
I will try to explain the problem, sorry for my english. I need unlit cutout shader which recieves shadows and works with deferred lighting.
First i tried to use modified standard cutout shader, added some bending and fake glare. It did not work well, even with using light probe(check screenshot). It is all about lighting, direct light does not works well with simple cross quad grass. Then i added some emissive and it became half decent :smile:, btw standard emission does not recieve shadows(ofc).
So i tried to use ForwardBase light mode. It looks good but it only works with forward rendering path.
It also has some wierd artifacts if i bend it with vertex shader.
Shader below.
So what should i do? I am newbie with hlsl. I hope my english skills is enough to explain this case.
May be there is some simple solution to make decent deferred grass?
Thx!

    Shader "Unlit Cutout Bending" {
        Properties {
            _Color ("Main Color", Color) = (1,1,1,1)
            _MainTex ("Base (RGB)", 2D) = "white" {}
            _Emission ("Emission", Range(0,1)) = 0.5
            _Cutoff  ("Alpha cutoff", Range(0,1)) = 0.5
            _WindSpeed("WindSpeed", Range (0, 10)) = 1.0
            _ShakeBending ("Bending", Range (0, 25)) = 1.0
             _CosScale ("CosScaleFactor", Range(1,25)) = 0.5

    
        }
        SubShader {
            Tags {"Queue" = "AlphaTest" "RenderType" = "TransparentCutout" "IgnoreProjector" = "True" }

            Pass {
                Tags {"LightMode" = "ForwardBase"}

                CGPROGRAM
                    #pragma vertex vert
                    #pragma fragment frag
                    #pragma multi_compile_fwdbase
                    #pragma alphatest:_Cutoff
                    #include "UnityCG.cginc"
                    #include "AutoLight.cginc"
                    sampler2D _MainTex;
                    float _WindSpeed;
                    float _ShakeBending;
                    float _CosScale;
                    float _Cutoff;
                    fixed4 _Color;
                    float _Emission;
                    struct v2f
                    {
                        fixed4  color : COLOR;
                        float4  pos         : SV_POSITION;
                        float2  uv          : TEXCOORD0;
               
                        LIGHTING_COORDS(1,2)
                    };

                    v2f vert (appdata_full v)
                    {

                        v2f o;
                        float3 WorldPosCos = mul(unity_ObjectToWorld, v.vertex);
                        float waveCos = cos(((WorldPosCos.x+WorldPosCos.y+WorldPosCos.z*2)+(cos((_Time[1]*_WindSpeed)/7)*_CosScale*5))/_CosScale);
                        float waveAmount = abs(waveCos*v.color.r*_ShakeBending);
                        o.pos = UnityObjectToClipPos(float4(((v.vertex.x)+waveAmount), ((v.vertex.y)+waveAmount),((v.vertex.z)+waveAmount), 0));
                        o.uv = v.texcoord.xy;
                        o.color = v.color.r*abs(waveCos)/8;
                        TRANSFER_VERTEX_TO_FRAGMENT(o);
                        return o;
                    }

                    fixed4 frag(v2f i) : COLOR
                    {
                
                        fixed4 color = tex2D(_MainTex, i.uv);
                        clip(color.a - _Cutoff);
                        fixed atten = LIGHT_ATTENUATION(i);
                        return color * atten * _Color + (color*_Emission)+i.color;
                
                    }

                ENDCG
            }

        }
        Fallback "Transparent/Cutout/VertexLit"
    }




Not really possible. Unity’s deferred pipeline uses their own “Standard” shading model. If you want something that doesn’t match the Standard shading model, then it cannot use Unity’s built in deferred pipeline. You could modify Unity’s deferred lighting model to change the behavior, but this would change how all deferred objects are rendered, so it’s a risky path. Some shader frameworks like Lux and Uber both do this to enable things like subsurface effects.

One alternative is to hack the normal to always face one direction. It’s a pretty common trick for grass rendering, just have the normal be straight up and ignore the mesh normals, or do some subtle blend of the two for variation. Often times this is done by overriding the base mesh’s normals rather than doing anything particularly fancy with the shader. It has the handy benefit of working with deferred rendering, though be sure to use very low gloss and specular reflections will look weird.

You could also point the normal such that it always faces the main directional light, which you would have to do in the shader. This also works in deferred since it’s just modifying the normal. It does require passing the main directional light’s direction in via a custom script as the deferred shader pass does not know the light direction. It has the same specular problems as the above technique too.

You could also just keep the forward path you’re using. It works fine, and since you don’t care about the various benefits of deferred in terms of multiple lights you’re not loosing too much. The main issue you’re having is the shadows don’t move with the grass when it moves. That’s because you’re not making a custom shadowcaster pass that has the same vertex animation. Adding that should solve the problem.
https://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html

Thank u very much. It looks good enough now. I see you have some clue about shading, can u help me once again?
Is it possible to move vertex along normal using vertex shader? Like on the picture below (blue arrow).

Well, i find out, thx again.

can you explain how please?