-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,389 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Shader "Anil/Lambert Ambient" | ||
{ | ||
Properties | ||
{ | ||
_Color ("Color" , Color) = (0,0,0,0) | ||
_Ambient("Ambient intensity",Range(0,2)) = 1 | ||
_Directional("Directional Light",Range(0,2)) = 0 | ||
} | ||
|
||
CGINCLUDE | ||
#include "UnityCG.cginc" | ||
#include "AutoLight.cginc" | ||
#include "Lighting.cginc" | ||
ENDCG | ||
|
||
Subshader | ||
{ | ||
Pass | ||
{ | ||
Tags{"Lightmode" = "ForwardBase"} | ||
|
||
Lighting On | ||
CGPROGRAM | ||
|
||
#pragma vertex vert | ||
#pragma fragment frag | ||
#pragma target 2.0 | ||
#pragma exclude_renderers gles | ||
#pragma multi_compile_fwdbase | ||
#pragma fragmentoption ARB_precision_hint_fastest | ||
#pragma fragmentoption ARB_fragment_program_shadow | ||
|
||
// user defined | ||
uniform half4 _Color; | ||
uniform half _Ambient; | ||
uniform half _Directional; | ||
|
||
// structs | ||
|
||
struct vertexInput | ||
{ | ||
half4 vertex : POSITION; | ||
half3 normal : NORMAL; | ||
}; | ||
|
||
struct vertexOutput | ||
{ | ||
half4 pos : SV_POSITION; | ||
half4 col : COLOR; | ||
LIGHTING_COORDS(1,2) | ||
}; | ||
|
||
vertexOutput vert(vertexInput v) | ||
{ | ||
vertexOutput o; | ||
|
||
half3 normalDirection = normalize(mul(half4(v.normal,0), unity_WorldToObject).xyz); | ||
half3 lightDirection = normalize(_WorldSpaceLightPos0.xyz)*_Directional; | ||
half3 difuseReflection = _LightColor0 * max(0,dot(normalDirection, lightDirection)); | ||
half3 lightFinal = difuseReflection + UNITY_LIGHTMODEL_AMBIENT.xyz * _Ambient; | ||
|
||
o.col = half4(lightFinal * _Color.rgb,1); | ||
|
||
o.pos = UnityObjectToClipPos(v.vertex); | ||
|
||
TRANSFER_VERTEX_TO_FRAGMENT(o); | ||
|
||
return o; | ||
} | ||
|
||
half4 frag(vertexOutput i) : COLOR | ||
{ | ||
i.col *= SHADOW_ATTENUATION(i); | ||
return i.col; | ||
} | ||
|
||
ENDCG | ||
} | ||
|
||
} | ||
FallBack "Diffuse" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
Shader "Anil/Lambert fog" | ||
{ | ||
Properties | ||
{ | ||
_Color ("Color" , Color) = (0,0,0,0) | ||
} | ||
|
||
Subshader | ||
{ | ||
|
||
Pass | ||
{ | ||
Tags{"Lightmode" = "ForwardBase"} | ||
|
||
CGPROGRAM | ||
|
||
#pragma vertex vert | ||
#pragma fragment frag | ||
#pragma target 2.0 | ||
// make fog work | ||
#pragma multi_compile_fog | ||
#include "UnityCG.cginc" | ||
|
||
// user defined | ||
uniform float4 _Color; | ||
|
||
// unity defined | ||
uniform float4 _LightColor0; | ||
|
||
// structs | ||
|
||
struct vertexInput | ||
{ | ||
float4 vertex : POSITION; | ||
float3 normal : NORMAL; | ||
}; | ||
|
||
struct vertexOutput | ||
{ | ||
UNITY_FOG_COORDS(1) | ||
float4 pos : SV_POSITION; | ||
float4 col : COLOR; | ||
}; | ||
|
||
vertexOutput vert(vertexInput v) | ||
{ | ||
vertexOutput o; | ||
|
||
float3 normalDirection = normalize(mul(float4(v.normal,0), unity_WorldToObject).xyz); | ||
float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz); | ||
float3 difuseReflection = _LightColor0 *_Color.rgb * max(0,dot(normalDirection, lightDirection)); | ||
|
||
o.col = float4(difuseReflection, 1); | ||
|
||
o.pos = UnityObjectToClipPos(v.vertex); | ||
|
||
UNITY_TRANSFER_FOG(o, o.pos); | ||
|
||
return o; | ||
} | ||
|
||
float4 frag(vertexOutput i) : COLOR | ||
{ | ||
UNITY_APPLY_FOG(i.fogCoord, i.col); | ||
return i.col; | ||
} | ||
|
||
ENDCG | ||
} | ||
|
||
// GÖLGE | ||
Pass | ||
{ | ||
Tags {"LightMode" = "ShadowCaster"} | ||
|
||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
#pragma multi_compile_shadowcaster | ||
#include "UnityCG.cginc" | ||
|
||
struct v2f { | ||
V2F_SHADOW_CASTER; | ||
}; | ||
|
||
v2f vert(appdata_base v) | ||
{ | ||
v2f o; | ||
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) | ||
return o; | ||
} | ||
|
||
float4 frag(v2f i) : SV_Target | ||
{ | ||
SHADOW_CASTER_FRAGMENT(i) | ||
} | ||
ENDCG | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
Shader "Anil/Best_AO" | ||
{ | ||
Properties | ||
{ | ||
_MainTex("Texture",2D) = "white" {} | ||
_AOTex("AO Texture",2D) = "white" {} | ||
// _Color ("Color", Color) = (1.0,1.0,1.0,1.0) | ||
_AOIntensity("AOIntensity" , Range(-2,2)) = 1 | ||
_Ambient("Ambient intensity",Range(0,2)) = 1 | ||
_Directional("Directional Light",Range(0,2)) = 1 | ||
} | ||
|
||
CGINCLUDE | ||
#include "UnityCG.cginc" | ||
#include "AutoLight.cginc" | ||
ENDCG | ||
|
||
SubShader | ||
{ | ||
LOD 100 | ||
Tags { "RenderType"="Opaque" } | ||
Pass | ||
{ | ||
Lighting On | ||
Tags {"LightMode" = "ForwardBase"} | ||
|
||
CGPROGRAM | ||
|
||
#pragma target 3.0 | ||
#pragma vertex vert | ||
#pragma exclude_renderers gles | ||
#pragma fragment frag Lambert | ||
#pragma fullforwardshadows | ||
#pragma multi_compile_fwdbase_fullshadows LIGHTMAP_ON LIGHTMAP_OFF | ||
#pragma fragmentoption ARB_precision_hint_fastest | ||
#pragma fragmentoption ARB_fragment_program_shadow | ||
|
||
uniform sampler2D _MainTex; | ||
uniform sampler2D _AOTex; | ||
uniform half4 _MainTex_ST; | ||
uniform half _Ambient; | ||
uniform half _Directional; | ||
uniform half _Colorful; | ||
uniform half _ColorMul; | ||
uniform half _AOIntensity; | ||
|
||
static const fixed4 _Color = (1,1,1,1); | ||
// unity defined | ||
uniform half4 _LightColor0; | ||
|
||
struct vertexInput | ||
{ | ||
half4 vertex : POSITION; | ||
half3 normal : NORMAL; | ||
half4 texcoord0 : TEXCOORD0; | ||
#ifdef LIGHTMAP_ON | ||
half2 texCoord1 : TEXCOORD1; | ||
#endif | ||
}; | ||
|
||
struct vertexOutput | ||
{ | ||
half4 pos : SV_POSITION; | ||
half4 col : COLOR; | ||
half2 uv0 : TEXCOORD4; | ||
#ifdef LIGHTMAP_ON | ||
half2 uv1: TEXCOORD3; | ||
#endif | ||
LIGHTING_COORDS(5,6) | ||
}; | ||
|
||
vertexOutput vert (vertexInput v) | ||
{ | ||
vertexOutput o; | ||
|
||
half4 posWorld = UnityObjectToClipPos(v.vertex); | ||
half3 normalWorld = normalize(v.normal).xyz; | ||
half4 ambient = UNITY_LIGHTMODEL_AMBIENT * _Ambient; | ||
half lightDirection = normalize(ObjSpaceLightDir(v.vertex)); | ||
half NdotL = saturate(dot(normalize(normalWorld),normalize(lightDirection)* _Directional)); | ||
//half3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - posWorld.xyz); | ||
|
||
o.pos = posWorld; | ||
o.uv0 = v.texcoord0; | ||
o.col = NdotL * _LightColor0 * _Color + ambient; | ||
|
||
#ifdef LIGHTMAP_ON | ||
o.uv1 = v.texCoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; | ||
#endif | ||
TRANSFER_SHADOW(o); | ||
|
||
return o; | ||
} | ||
|
||
fixed4 frag(vertexOutput i) : COLOR | ||
{ | ||
i.col *= SHADOW_ATTENUATION(i) * (tex2D(_AOTex, i.uv0 ).r + _AOIntensity); | ||
|
||
#ifdef LIGHTMAP_ON | ||
return UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv1.xy) * i.col * tex2D(_MainTex,i.uv0); | ||
#else | ||
return i.col * tex2D(_MainTex,i.uv0) ; | ||
#endif | ||
} | ||
ENDCG | ||
} | ||
} | ||
FallBack "Diffuse" | ||
} |
Oops, something went wrong.