Unwrap Shader with Shadow Information

Hi,

I am trying to implement an Unwrap Shader which writes the results to a render target including the ’ Shadow ’ Information . I managed to get the unwrap working in screen space however how Can I add the shadow / lighting to this, I would greatly appreciate any help!

Unwrap code

Shader  "Custom/NewShader1"

{

    Properties

    {

        _Color ("Main Colour", Color ) = (1,1,1,0)

        _ShadowTex ("Cookie", 2D) = "gray" { TexGen ObjectLinear }

        _BaseTexture ("Base Texture", 2D) = "white" {}

    }

    SubShader

    {

        Tags {"Queue" = "Geometry" "RenderType" = "Opaque"}

        Pass

        {

			Tags {"LightMode" = "ForwardBase"}
			
          //  ZWrite Off

          //  Offset -1, -1

          //  AlphaTest Greater 0

          //  Blend  SrcAlpha OneMinusSrcAlpha

 

            CGPROGRAM

            #pragma vertex vert_main
            #pragma fragment frag_main
            #pragma multi_compile_fwdbase
            #pragma target 3.0
            #pragma fragmentoption ARB_precision_hint_fastest 
             #pragma fragmentoption ARB_fog_exp2
            #include "UnityCG.cginc"
			#include "AutoLight.cginc"
            

            sampler2D _ShadowTex = sampler_state

            {

                Texture  = <_ShadowText>;

                AddressU = CLAMP;

                AddressV = CLAMP;

            };

            sampler2D _BaseTexture;

            float4x4 _Projector;

            float4 _Color;
			fixed4 _LightColor0;
            

            struct Output_Struct {

                float4 position      : SV_POSITION;

                float4 texcoord     : TEXCOORD0;

                float4 normalProj   : TEXCOORD1;

                float2 basecoord    : COLOR0;
                
                LIGHTING_COORDS(3,4)

            };   

            

            Output_Struct vert_main (appdata_tan v)

            {

                Output_Struct OUT;

 

                OUT.position .xy = v.texcoord.xy * 2.0 - 1.0;
                // OUT.position .xy = mul( UNITY_MATRIX_MVP, v.vertex);
				
				TANGENT_SPACE_ROTATION;
                // flip Y, UV are upside down, for some reason

                // this is needed

                OUT.position .y *= -1;

                OUT.position .z = 0;

                OUT.position .w = 1;//v.vertex.w;

                OUT.texcoord = mul(_Projector, v.vertex);

                OUT.basecoord = v.texcoord.xy;

                OUT.normalProj = mul (_Projector, float4(v.normal , 0.0));
                
               //TRANSFER_VERTEX_TO_FRAGMENT(OUT);

                return OUT;

            }

 

            float4 frag_main (Output_Struct OUT) : COLOR

            {

               // fixed atten = LIGHT_ATTENUATION(i);
               
                
              //  float d = dot (float4(0,0,-1,0), OUT.normalProj);

                float4 tex = tex2D(_BaseTexture, OUT.basecoord) * _Color;

               // if (d < 0)

               //     tex.a = 0;

                // Uncomment this line for add the base texture.

               // tex += tex2D(_BaseTexture, OUT.basecoord);

                return tex;

            }

            ENDCG

        }

    }

}

Bump …

Surprising no one can help me on this? Can anyone from Unity perhaps help out as we have the Pro License? It is amazing that Unity has very little involvement when it comes to technical support, it seems they just let the community deal with all the questions and help for paying customers :frowning:

As I have mentioned we need to include the shadow information when we are writing the unwrapped version of a model to screenspace quad (rendertarget), there must be a way to do this. Any help in the right direction will be much appreciate it!