Skip to main content
deleted 413 characters in body
Source Link
Will C
  • 146
  • 4

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf"  
{   
Properties  
{
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
{    Tags {"RenderType"="Opaque" } 
    LODPass 200

    CGPROGRAM{
    #pragma surface surf Lambert
 CGPROGRAM
    sampler2D _MainTex;
   #pragma fixed4vertex _Color;vert_img
    struct Input {
  #pragma fragment frag

    float2 uv_MainTex;
   #include };"UnityCG.cginc"

    void surf (Input IN, inout SurfaceOutputuniform o)sampler2D {_MainTex;

        half4float4 cfrag(v2f_img =i) tex2D: (_MainTex,COLOR IN.uv_MainTex);
        o.Albedo{
 = c.rgb * _Color;
        o.Alphareturn =tex2D(_MainTex, ci.a;uv);
        }
        ENDCG
}    }
}}

Edit: I misunderstood the question. I've replaced the previous shader with the simplest possible vertex and fragment shader that works in the VertexLit render path. If you want objects to receive per pixel lighting you will need to use Forward or Deferred rendering as per http://docs.unity3d.com/Documentation/Manual/RenderingPaths.html

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" }
    LOD 200

    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
}
Shader "SimpleSurf"  
{   
Properties  
{
    _MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader 
{       
    Pass 
    {
        CGPROGRAM
        #pragma vertex vert_img
        #pragma fragment frag

        #include "UnityCG.cginc"

        uniform sampler2D _MainTex;

        float4 frag(v2f_img i) : COLOR 
        {
            return tex2D(_MainTex, i.uv);
        }
        ENDCG
    }
}}

Edit: I misunderstood the question. I've replaced the previous shader with the simplest possible vertex and fragment shader that works in the VertexLit render path. If you want objects to receive per pixel lighting you will need to use Forward or Deferred rendering as per http://docs.unity3d.com/Documentation/Manual/RenderingPaths.html

deleted 23 characters in body
Source Link
Will C
  • 146
  • 4

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" "LightMode" = "Vertex" }
    LOD 200

    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
}

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" "LightMode" = "Vertex" }
    LOD 200

    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
}

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" }
    LOD 200

    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
}
Edited: Forgot the all important tag and removed Fallback for clarity.
Source Link
Will C
  • 146
  • 4

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" "LightMode" = "Vertex" }
    LOD 200
    Lighting Off
    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
FallBack "Diffuse"}

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" }
    LOD 200
    Lighting Off
    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
FallBack "Diffuse"}

This is a visual artifact of the Unity's VertexLit rendering path.

Simply adding a color property and multiplying your albedo by it will produce your desired result.

Shader "SimpleSurf" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
    Tags {"RenderType"="Opaque" "LightMode" = "Vertex" }
    LOD 200

    CGPROGRAM
    #pragma surface surf Lambert

    sampler2D _MainTex;
    fixed4 _Color;
    struct Input {
        float2 uv_MainTex;
    };

    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D (_MainTex, IN.uv_MainTex);
        o.Albedo = c.rgb * _Color;
        o.Alpha = c.a;
    }
    ENDCG
} 
}
Source Link
Will C
  • 146
  • 4
Loading