files
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#ifndef DC_UVFREE_COMMON_INCLUDED
|
||||
#define DC_UVFREE_COMMON_INCLUDED
|
||||
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeVertexColor.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeMain.cginc"
|
||||
|
||||
#endif // DC_UVFREE_COMMON_INCLUDED
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db616f0af7e064eeaa36fa8067daff7e
|
||||
timeCreated: 1472188568
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
uniform half _VertexColorPower;
|
||||
#define DC_UVFREE_VCOLOR fixed4 v_color;
|
||||
#define DC_UVFREE_INPUT \
|
||||
fixed4 color : COLOR;
|
||||
#define DC_UVFREE_OUPUT(id1,id2)\
|
||||
float4 vertex : VERTEX;\
|
||||
_DC_UVFREE_WORLD_POS\
|
||||
half3 objNormal : NORMAL;\
|
||||
fixed4 v_color : COLOR;
|
||||
#define DC_UVFREE_TRANSFER(output,tex)\
|
||||
output.vertex = v.vertex;\
|
||||
_DC_UVFREE_WORLD_POS_TRANSFER(output)\
|
||||
output.objNormal = v.normal;\
|
||||
output.v_color=lerp(fixed4(1,1,1,1),v.color,_VertexColorPower);
|
||||
#define DC_UNFREE_VERTEX_ALPHA(input_color) input_color.a*=i.v_color.a;
|
||||
#define DC_UVFREE_FINAL(input,col) col.rgb*=input.v_color.rgb;
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f06985c5ce96849d4ba0ae9ec3e161a9
|
||||
timeCreated: 1474187647
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,145 @@
|
||||
// Fix for Unity 5.4 upgrade
|
||||
//UNITY_SHADER_NO_UPGRADE
|
||||
#if UNITY_VERSION >= 540
|
||||
#define _Object2World unity_ObjectToWorld
|
||||
// #define _World2Object unity_WorldToObject
|
||||
#endif
|
||||
|
||||
uniform int _UVSecMain;
|
||||
uniform half _Shininess;
|
||||
uniform sampler2D _BumpMap;
|
||||
uniform half _BumpScale;
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_UP_FRONT || _UVFREE_UP_LEFT
|
||||
uniform float _PowerTop;
|
||||
uniform fixed4 _ColorTop;
|
||||
uniform sampler2D _MainTexTop;
|
||||
uniform fixed4 _MainTexTop_ST;
|
||||
uniform half _ShininessTop;
|
||||
uniform sampler2D _BumpMapTop;
|
||||
uniform half _BumpScaleTop;
|
||||
#endif
|
||||
|
||||
#if _UVFREE_DOWN_BOTTOM || _UVFREE_DOWN_BACK || _UVFREE_DOWN_RIGHT
|
||||
uniform float _PowerBottom;
|
||||
uniform fixed4 _ColorBottom;
|
||||
uniform sampler2D _MainTexBottom;
|
||||
uniform fixed4 _MainTexBottom_ST;
|
||||
uniform half _ShininessBottom;
|
||||
uniform sampler2D _BumpMapBottom;
|
||||
uniform half _BumpScaleBottom;
|
||||
#endif
|
||||
|
||||
#if _UVFREE_WORLDSPACE
|
||||
#define DC_UVFREE_WORLD_POS float3 worldPos;
|
||||
#define _DC_UVFREE_WORLD_POS float3 worldPos : COLOR3;
|
||||
#define _DC_UVFREE_WORLD_POS_TRANSFER(output) output.worldPos = mul(_Object2World, v.vertex.xyz);
|
||||
#define DC_UVFREE_SETUP(input_normal)\
|
||||
half3 uv_normal = UnityObjectToWorldNormal(input_normal);\
|
||||
half3 blend = abs(uv_normal);\
|
||||
blend /= dot(blend,1.0);
|
||||
#define DC_UVFREE_UV_APPLY(input,tex)\
|
||||
_DC_UVFREE_UV_APPLY(i.worldPos,tex);
|
||||
|
||||
#define _DC_UVFREE_UV_APPLY(pos,tex)\
|
||||
float2 tex##_uv_raw_x = pos.xy*tex##_ST.xy+tex##_ST.zw;\
|
||||
float2 tex##_uv_raw_y = pos.xz*tex##_ST.xy+tex##_ST.zw;\
|
||||
float2 tex##_uv_raw_z = pos.zy*tex##_ST.xy+tex##_ST.zw;\
|
||||
float4 tex##_uv_x = float4(tex##_uv_raw_x,4,0);\
|
||||
float4 tex##_uv_y = float4(tex##_uv_raw_y,4,0);\
|
||||
float4 tex##_uv_z = float4(tex##_uv_raw_z,4,0);\
|
||||
float lz = clamp((blend.z-0.45)*10,0,1);\
|
||||
float ly = clamp((blend.y-0.45)*10,0,1);
|
||||
#else
|
||||
#define DC_UVFREE_WORLD_POS
|
||||
#define _DC_UVFREE_WORLD_POS
|
||||
#define _DC_UVFREE_WORLD_POS_TRANSFER(output)
|
||||
#define DC_UVFREE_SETUP(input_normal)\
|
||||
half3 uv_normal = normalize(input_normal);\
|
||||
half3 blend = abs(uv_normal);\
|
||||
blend /= dot(blend,1.0);
|
||||
#define DC_UVFREE_UV_APPLY(input,tex)\
|
||||
_DC_UVFREE_UV_APPLY(input.vertex,tex);
|
||||
|
||||
#define _DC_UVFREE_UV_APPLY(pos,tex)\
|
||||
float2 tex##_uv_raw_x = pos.xy*tex##_ST.xy+tex##_ST.zw;\
|
||||
float2 tex##_uv_raw_y = pos.xz*tex##_ST.xy+tex##_ST.zw;\
|
||||
float2 tex##_uv_raw_z = pos.zy*tex##_ST.xy+tex##_ST.zw;\
|
||||
float4 tex##_uv_x = float4(tex##_uv_raw_x,4,0);\
|
||||
float4 tex##_uv_y = float4(tex##_uv_raw_y,4,0);\
|
||||
float4 tex##_uv_z = float4(tex##_uv_raw_z,4,0);\
|
||||
float lz = clamp((blend.z-0.45)*10,0,1);\
|
||||
float ly = clamp((blend.y-0.45)*10,0,1);
|
||||
#endif
|
||||
|
||||
#define DC_UVFREE_APPLY_MAIN_TEX(col) DC_UVFREE_TEX_APPLY(col,_MainTex,_MainTex);
|
||||
|
||||
#define DC_UVFREE_TEX_APPLY_LOD(col,tex,uv)\
|
||||
fixed4 tex##_z = tex2Dlod(tex, uv##_uv_z);\
|
||||
fixed4 tex##_x = tex2Dlod(tex, uv##_uv_x);\
|
||||
fixed4 tex##_y = tex2Dlod(tex, uv##_uv_y);\
|
||||
col = lerp(tex##_z,tex##_x,lz);\
|
||||
col = lerp(col,tex##_y,ly);DC_UNFREE_VERTEX_ALPHA(col);
|
||||
|
||||
#define DC_UVFREE_TEX_APPLY(col,tex,uv)\
|
||||
fixed4 tex##_z = tex2D(tex, uv##_uv_raw_z);\
|
||||
fixed4 tex##_x = tex2D(tex, uv##_uv_raw_x);\
|
||||
fixed4 tex##_y = tex2D(tex, uv##_uv_raw_y);\
|
||||
col = lerp(tex##_z,tex##_x,lz);\
|
||||
col = lerp(col,tex##_y,ly);
|
||||
|
||||
//#define DC_UVFREE_NORMAL_APPLY(col,tex,bump)\
|
||||
// fixed3 bump##_z = UnpackNormal(tex2Dlod(bump, tex##_uv_z));\
|
||||
// fixed3 bump##_x = UnpackNormal(tex2Dlod(bump, tex##_uv_x));\
|
||||
// fixed3 bump##_y = UnpackNormal(tex2Dlod(bump, tex##_uv_y));\
|
||||
// col = lerp(bump##_z,bump##_x,lz);\
|
||||
// col = lerp(col,bump##_y,ly);
|
||||
|
||||
#define DC_UVFREE_SCALE_NORMAL_APPLY(col,tex,uv,scale)\
|
||||
half3 tex##_n_z = UnpackScaleNormal(tex2Dlod(tex, uv##_uv_z),scale);\
|
||||
half3 tex##_n_x = UnpackScaleNormal(tex2Dlod(tex, uv##_uv_x),scale);\
|
||||
half3 tex##_n_y = UnpackScaleNormal(tex2Dlod(tex, uv##_uv_y),scale);\
|
||||
col = lerp(tex##_n_z,tex##_n_x,lz);\
|
||||
col = lerp(col,tex##_n_y,ly);
|
||||
|
||||
#define DC_UVFREE_METALLICGLOSS_APPLY(col,tex,uv)\
|
||||
half2 tex##_m_z = tex2Dlod(tex, uv##_uv_z).ra;\
|
||||
half2 tex##_m_x = tex2Dlod(tex, uv##_uv_x).ra;\
|
||||
half2 tex##_m_y = tex2Dlod(tex, uv##_uv_y).ra;\
|
||||
col = lerp(tex##_m_z,tex##_m_x,lz);\
|
||||
col = lerp(col,tex##_m_y,ly);
|
||||
|
||||
#define DC_UVFREE_OCC_APPLY(col,tex,uv)\
|
||||
half tex##_o_z = tex2Dlod(tex, uv##_uv_z).r;\
|
||||
half tex##_o_x = tex2Dlod(tex, uv##_uv_x).r;\
|
||||
half tex##_o_y = tex2Dlod(tex, uv##_uv_y).r;\
|
||||
col = lerp(tex##_o_z,tex##_o_x,lz);\
|
||||
col = lerp(col,tex##_o_y,ly);
|
||||
|
||||
#define _DC_UVFREE_POWER(b,power) clamp((b-((1-power)+0.1)/1.1)*5,0,1)
|
||||
|
||||
// Y
|
||||
#define DC_UVFREE_VALUE_Y(col,input_col,power)\
|
||||
col = lerp(col,input_col,_DC_UVFREE_POWER(blend.y,(power*input_col.a)));
|
||||
|
||||
#define DC_UVFREE_LERP_RATIO_Y(col,input_col,power,r)\
|
||||
r = _DC_UVFREE_POWER(blend.y,(power*input_col.a));\
|
||||
col = lerp(col,input_col,r);
|
||||
|
||||
// X
|
||||
#define DC_UVFREE_VALUE_X(col,input_col,power)\
|
||||
col = lerp(col,input_col,_DC_UVFREE_POWER(blend.x,(power*input_col.a)));
|
||||
|
||||
#define DC_UVFREE_LERP_RATIO_X(col,input_col,power,r)\
|
||||
r = _DC_UVFREE_POWER(blend.x,(power*input_col.a));\
|
||||
col = lerp(col,input_col,r);
|
||||
|
||||
// Z
|
||||
#define DC_UVFREE_VALUE_Z(col,input_col,power)\
|
||||
col = lerp(col,input_col,_DC_UVFREE_POWER(blend.z,(power*input_col.a)));
|
||||
|
||||
#define DC_UVFREE_LERP_RATIO_Z(col,input_col,power,r)\
|
||||
r = _DC_UVFREE_POWER(blend.z,(power*input_col.a));\
|
||||
col = lerp(col,input_col,r);
|
||||
|
||||
#define DC_UVFREE_LERP(col,input_col,r) col = lerp(col,input_col,r);
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5920e2b8d20bf4aee8053543654569e6
|
||||
timeCreated: 1474189778
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,174 @@
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform half _Glossiness;
|
||||
uniform half _GlossinessTop;
|
||||
uniform half _GlossinessBottom;
|
||||
|
||||
uniform float _Top;
|
||||
uniform float _Bottom;
|
||||
|
||||
uniform float _PowerTop;
|
||||
uniform fixed4 _ColorTop;
|
||||
uniform sampler2D _MainTexTop;
|
||||
uniform fixed4 _MainTexTop_ST;
|
||||
uniform half _ShininessTop;
|
||||
uniform sampler2D _BumpMapTop;
|
||||
uniform half _BumpScaleTop;
|
||||
|
||||
uniform float _PowerBottom;
|
||||
uniform fixed4 _ColorBottom;
|
||||
uniform sampler2D _MainTexBottom;
|
||||
uniform fixed4 _MainTexBottom_ST;
|
||||
uniform half _ShininessBottom;
|
||||
uniform sampler2D _BumpMapBottom;
|
||||
uniform half _BumpScaleBottom;
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
half3 objNormal;
|
||||
DC_UVFREE_WORLD_POS
|
||||
DC_UVFREE_VCOLOR
|
||||
INTERNAL_DATA
|
||||
};
|
||||
|
||||
void vert (inout appdata_full v, out Input o) {
|
||||
UNITY_INITIALIZE_OUTPUT(Input,o);
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
}
|
||||
|
||||
void surf (Input i, inout UV_FREE_STANDARD_OUTPUT o) {
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = _Color;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex)
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(0.5,0.5,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
DC_UVFREE_MS
|
||||
DC_UVFREE_OCC
|
||||
|
||||
// X
|
||||
// #if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
// #if _UVFREE_UP_LEFT
|
||||
if(_Top==3){
|
||||
fixed4 top_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_LERP_RATIO_X(c,(top_c*_ColorTop),_PowerTop,ratio);
|
||||
|
||||
fixed3 top_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(top_n,_BumpMapTop,_MainTexTop,_BumpScaleTop);
|
||||
DC_UVFREE_LERP(n,top_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_UP
|
||||
DC_UVFREE_OCC_UP
|
||||
}
|
||||
// #endif
|
||||
} else {
|
||||
// #if _UVFREE_DOWN_RIGHT
|
||||
if(_Bottom==3){
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_LERP_RATIO_X(c,(bottom_c*_ColorBottom),_PowerBottom,ratio);
|
||||
|
||||
fixed3 bottom_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(bottom_n,_BumpMapBottom,_MainTexBottom,_BumpScaleBottom);
|
||||
DC_UVFREE_LERP(n,bottom_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_DOWN
|
||||
DC_UVFREE_OCC_DOWN
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
// Z
|
||||
// #if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
// #if _UVFREE_UP_FRONT
|
||||
if(_Top==2){
|
||||
fixed4 top_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_LERP_RATIO_Z(c,(top_c*_ColorTop),_PowerTop,ratio);
|
||||
|
||||
fixed3 top_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(top_n,_BumpMapTop,_MainTexTop,_BumpScaleTop);
|
||||
DC_UVFREE_LERP(n,top_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_UP
|
||||
DC_UVFREE_OCC_UP
|
||||
}
|
||||
// #endif
|
||||
} else {
|
||||
// #if _UVFREE_DOWN_BACK
|
||||
if(_Bottom==2){
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_LERP_RATIO_Z(c,(bottom_c*_ColorBottom),_PowerBottom,ratio);
|
||||
|
||||
fixed3 bottom_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(bottom_n,_BumpMapBottom,_MainTexBottom,_BumpScaleBottom);
|
||||
DC_UVFREE_LERP(n,bottom_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_DOWN
|
||||
DC_UVFREE_OCC_DOWN
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
// Y
|
||||
// #if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0)
|
||||
{
|
||||
// #if _UVFREE_UP_TOP
|
||||
if(_Top==1){
|
||||
fixed4 top_c = _ColorTop;half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_LERP_RATIO_Y(c,(top_c*_ColorTop),_PowerTop,ratio);
|
||||
|
||||
fixed3 top_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(top_n,_BumpMapTop,_MainTexTop,_BumpScaleTop);
|
||||
DC_UVFREE_LERP(n,top_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_UP
|
||||
DC_UVFREE_OCC_UP
|
||||
}
|
||||
// #endif
|
||||
|
||||
} else {
|
||||
|
||||
// #if _UVFREE_DOWN_BOTTOM
|
||||
if(_Bottom==1){
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_LERP_RATIO_Y(c,(bottom_c*_ColorBottom),_PowerBottom,ratio);
|
||||
|
||||
fixed3 bottom_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(bottom_n,_BumpMapBottom,_MainTexBottom,_BumpScaleBottom);
|
||||
DC_UVFREE_LERP(n,bottom_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_DOWN
|
||||
DC_UVFREE_OCC_DOWN
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
DC_UVFREE_APPLY_MS
|
||||
// DC_UVFREE_APPLY_OCC
|
||||
o.Albedo = c.rgb;
|
||||
o.Normal = n.rgb;
|
||||
o.Alpha = c.a;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bdfad89cd8c84176b9dcb4630bb478b
|
||||
timeCreated: 1472955885
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
uniform half _Metallic;
|
||||
uniform sampler2D _MetallicGlossMap;
|
||||
uniform half _MetallicTop;
|
||||
uniform sampler2D _MetallicGlossMapTop;
|
||||
uniform half _MetallicBottom;
|
||||
uniform sampler2D _MetallicGlossMapBottom;
|
||||
|
||||
#define UV_FREE_STANDARD_OUTPUT SurfaceOutputStandard
|
||||
|
||||
#if _METALLICGLOSSMAP
|
||||
#define DC_UVFREE_MS\
|
||||
fixed2 mg = half2(_Metallic, _Glossiness);\
|
||||
DC_UVFREE_METALLICGLOSS_APPLY(mg,_MetallicGlossMap,_MainTex)
|
||||
#else
|
||||
#define DC_UVFREE_MS fixed2 mg = half2(_Metallic, _Glossiness);
|
||||
#endif
|
||||
|
||||
#if _METALLICGLOSSMAP_TOP
|
||||
#define DC_UVFREE_MS_UP\
|
||||
half2 top_mg = half2(_MetallicTop, _GlossinessTop);\
|
||||
DC_UVFREE_METALLICGLOSS_APPLY(top_mg,_MetallicGlossMapTop,_MainTexTop)\
|
||||
DC_UVFREE_LERP(mg,top_mg,ratio)
|
||||
#else
|
||||
#define DC_UVFREE_MS_UP\
|
||||
half2 top_mg = half2(_MetallicTop, _GlossinessTop);\
|
||||
DC_UVFREE_LERP(mg,top_mg,ratio)
|
||||
#endif
|
||||
|
||||
#if _METALLICGLOSSMAP_BOTTOM
|
||||
#define DC_UVFREE_MS_DOWN\
|
||||
half2 bottom_mg = half2(_MetallicBottom, _GlossinessBottom);\
|
||||
DC_UVFREE_METALLICGLOSS_APPLY(bottom_mg,_MetallicGlossMapBottom,_MainTexBottom)\
|
||||
DC_UVFREE_LERP(mg,bottom_mg,ratio)
|
||||
#else
|
||||
#define DC_UVFREE_MS_DOWN\
|
||||
half2 bottom_mg = half2(_MetallicBottom, _GlossinessBottom);\
|
||||
DC_UVFREE_LERP(mg,bottom_mg,ratio)
|
||||
#endif
|
||||
|
||||
#define DC_UVFREE_APPLY_MS\
|
||||
o.Metallic = mg.x;\
|
||||
o.Smoothness = mg.y;
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e86631cf35c04caa91d72cb04c42853
|
||||
timeCreated: 1474208752
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
#define DC_UVFREE_OCC
|
||||
#define DC_UVFREE_OCC_UP
|
||||
#define DC_UVFREE_OCC_DOWN
|
||||
#define DC_UVFREE_APPLY_OCC
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe2cae79d143c473396a6c60110209f8
|
||||
timeCreated: 1474206850
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
uniform half _OcclusionStrength;
|
||||
uniform sampler2D _OcclusionMap;
|
||||
uniform half _OcclusionStrengthTop;
|
||||
uniform sampler2D _OcclusionMapTop;
|
||||
uniform half _OcclusionStrengthBottom;
|
||||
uniform sampler2D _OcclusionMapBottom;
|
||||
|
||||
#define DC_UVFREE_OCC\
|
||||
half oc = 1;\
|
||||
DC_UVFREE_OCC_APPLY(oc,_OcclusionMap,_MainTex)\
|
||||
oc=lerp(1,oc,_OcclusionStrength);
|
||||
|
||||
#define DC_UVFREE_OCC_UP\
|
||||
half top_occ = 1;\
|
||||
DC_UVFREE_OCC_APPLY(top_occ,_OcclusionMapTop,_MainTexTop)\
|
||||
top_occ=lerp(1,top_occ,_OcclusionStrengthTop);\
|
||||
DC_UVFREE_LERP(oc,top_occ,ratio);
|
||||
|
||||
#define DC_UVFREE_OCC_DOWN\
|
||||
half bottom_occ = 1;\
|
||||
DC_UVFREE_OCC_APPLY(bottom_occ,_OcclusionMapBottom,_MainTexBottom);\
|
||||
bottom_occ=lerp(1,bottom_occ,_OcclusionStrengthBottom);\
|
||||
DC_UVFREE_LERP(oc,bottom_occ,ratio);
|
||||
|
||||
#define DC_UVFREE_APPLY_OCC o.Occlusion=oc;
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b75fa804389a44273bfffa9cfca02662
|
||||
timeCreated: 1474206850
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,166 @@
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform half _Glossiness;
|
||||
uniform half _GlossinessTop;
|
||||
uniform half _GlossinessBottom;
|
||||
|
||||
uniform float _Top;
|
||||
uniform float _Bottom;
|
||||
|
||||
uniform float _PowerTop;
|
||||
uniform fixed4 _ColorTop;
|
||||
uniform sampler2D _MainTexTop;
|
||||
uniform fixed4 _MainTexTop_ST;
|
||||
uniform half _ShininessTop;
|
||||
uniform sampler2D _BumpMapTop;
|
||||
uniform half _BumpScaleTop;
|
||||
|
||||
uniform float _PowerBottom;
|
||||
uniform fixed4 _ColorBottom;
|
||||
uniform sampler2D _MainTexBottom;
|
||||
uniform fixed4 _MainTexBottom_ST;
|
||||
uniform half _ShininessBottom;
|
||||
uniform sampler2D _BumpMapBottom;
|
||||
uniform half _BumpScaleBottom;
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
half3 objNormal;
|
||||
DC_UVFREE_WORLD_POS
|
||||
INTERNAL_DATA
|
||||
};
|
||||
|
||||
void vert (inout appdata_full v, out Input o) {
|
||||
UNITY_INITIALIZE_OUTPUT(Input,o);
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
}
|
||||
|
||||
void surf (Input i, inout UV_FREE_STANDARD_OUTPUT o) {
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal);
|
||||
|
||||
fixed4 projectorColor = tex2Dproj (_ProjectorTex, UNITY_PROJ_COORD(mul (unity_Projector, i.vertex)));
|
||||
fixed4 projectorFalloff = tex2Dproj (_ProjectorFalloffTex, UNITY_PROJ_COORD(mul (unity_ProjectorClip, i.vertex)));
|
||||
|
||||
fixed4 c = _Color;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex)
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(0.5,0.5,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
DC_UVFREE_MS
|
||||
DC_UVFREE_OCC
|
||||
|
||||
// X
|
||||
if(uv_normal.x>0){
|
||||
if(_Top==3){
|
||||
fixed4 top_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_LERP_RATIO_X(c,(top_c*_ColorTop),_PowerTop,ratio);
|
||||
|
||||
fixed3 top_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(top_n,_BumpMapTop,_MainTexTop,_BumpScaleTop);
|
||||
DC_UVFREE_LERP(n,top_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_UP
|
||||
DC_UVFREE_OCC_UP
|
||||
}
|
||||
} else {
|
||||
if(_Bottom==3){
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_LERP_RATIO_X(c,(bottom_c*_ColorBottom),_PowerBottom,ratio);
|
||||
|
||||
fixed3 bottom_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(bottom_n,_BumpMapBottom,_MainTexBottom,_BumpScaleBottom);
|
||||
DC_UVFREE_LERP(n,bottom_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_DOWN
|
||||
DC_UVFREE_OCC_DOWN
|
||||
}
|
||||
}
|
||||
// Z
|
||||
if(uv_normal.z>0){
|
||||
if(_Top==2){
|
||||
fixed4 top_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_LERP_RATIO_Z(c,(top_c*_ColorTop),_PowerTop,ratio);
|
||||
|
||||
fixed3 top_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(top_n,_BumpMapTop,_MainTexTop,_BumpScaleTop);
|
||||
DC_UVFREE_LERP(n,top_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_UP
|
||||
DC_UVFREE_OCC_UP
|
||||
}
|
||||
} else {
|
||||
if(_Bottom==2){
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_LERP_RATIO_Z(c,(bottom_c*_ColorBottom),_PowerBottom,ratio);
|
||||
|
||||
fixed3 bottom_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(bottom_n,_BumpMapBottom,_MainTexBottom,_BumpScaleBottom);
|
||||
DC_UVFREE_LERP(n,bottom_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_DOWN
|
||||
DC_UVFREE_OCC_DOWN
|
||||
}
|
||||
}
|
||||
// Y
|
||||
if(uv_normal.y>0)
|
||||
{
|
||||
if(_Top==1){
|
||||
fixed4 top_c = _ColorTop;half ratio;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_LERP_RATIO_Y(c,(top_c*_ColorTop),_PowerTop,ratio);
|
||||
|
||||
fixed3 top_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(top_n,_BumpMapTop,_MainTexTop,_BumpScaleTop);
|
||||
DC_UVFREE_LERP(n,top_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_UP
|
||||
DC_UVFREE_OCC_UP
|
||||
}
|
||||
} else {
|
||||
if(_Bottom==1){
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
float ratio=1;
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_LERP_RATIO_Y(c,(bottom_c*_ColorBottom),_PowerBottom,ratio);
|
||||
|
||||
fixed3 bottom_n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(bottom_n,_BumpMapBottom,_MainTexBottom,_BumpScaleBottom);
|
||||
DC_UVFREE_LERP(n,bottom_n,ratio);
|
||||
|
||||
DC_UVFREE_MS_DOWN
|
||||
DC_UVFREE_OCC_DOWN
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
DC_UVFREE_APPLY_MS
|
||||
DC_UVFREE_APPLY_OCC
|
||||
|
||||
float pa = projectorColor.a*projectorFalloff.a;
|
||||
|
||||
o.Normal = n.rgb;
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = pa*c.a;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afe3220d5591d4d70aab1e0a422277af
|
||||
timeCreated: 1472955885
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
//uniform half3 _SpecColor;
|
||||
uniform sampler2D _SpecGlossMap;
|
||||
uniform half3 _SpecColorTop;
|
||||
uniform sampler2D _SpecGlossMapTop;
|
||||
uniform half3 _SpecColorBottom;
|
||||
uniform sampler2D _SpecGlossMapBottom;
|
||||
|
||||
#define UV_FREE_STANDARD_OUTPUT SurfaceOutputStandardSpecular
|
||||
|
||||
#if _SPECGLOSSMAP
|
||||
#define DC_UVFREE_MS\
|
||||
half4 sg = fixed4(_SpecColor.rgb, _Glossiness);\
|
||||
DC_UVFREE_TEX_APPLY(sg,_SpecGlossMap,_MainTex)
|
||||
|
||||
#else
|
||||
#define DC_UVFREE_MS half4 sg = fixed4(_SpecColor.rgb, _Glossiness);
|
||||
#endif
|
||||
|
||||
#if _SPECGLOSSMAP_TOP
|
||||
#define DC_UVFREE_MS_UP\
|
||||
half4 top_sg = half4(_SpecColorTop.rgb, _GlossinessTop);\
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_sg,_SpecGlossMapTop,_MainTexTop)\
|
||||
DC_UVFREE_LERP(sg,top_sg,ratio);
|
||||
#else
|
||||
#define DC_UVFREE_MS_UP\
|
||||
half4 top_sg = half4(_SpecColorTop.rgb, _GlossinessTop);\
|
||||
DC_UVFREE_LERP(sg,top_sg,ratio);
|
||||
#endif
|
||||
|
||||
#if _SPECGLOSSMAP_BOTTOM
|
||||
#define DC_UVFREE_MS_DOWN\
|
||||
half4 bottom_sg = half4(_SpecColorBottom.rgb, _GlossinessBottom);\
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_sg,_SpecGlossMapBottom,_MainTexBottom)\
|
||||
DC_UVFREE_LERP(sg,bottom_sg,ratio);
|
||||
|
||||
#else
|
||||
#define DC_UVFREE_MS_DOWN\
|
||||
half4 bottom_sg = half4(_SpecColorBottom.rgb, _GlossinessBottom);\
|
||||
DC_UVFREE_LERP(sg,bottom_sg,ratio);
|
||||
|
||||
#endif
|
||||
|
||||
#define DC_UVFREE_APPLY_MS\
|
||||
o.Specular = sg.rgb;\
|
||||
o.Smoothness = sg.a;
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51c2db575c9454252a7e1d696e55730b
|
||||
timeCreated: 1474250610
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
#if _UVFREE_VERTEX_COLOR
|
||||
uniform half _VertexColorPower;
|
||||
#define DC_UVFREE_VCOLOR fixed4 v_color;
|
||||
#define DC_UVFREE_INPUT \
|
||||
fixed4 color : COLOR;
|
||||
#define DC_UVFREE_OUPUT(id1,id2)\
|
||||
float4 vertex : VERTEX;\
|
||||
_DC_UVFREE_WORLD_POS\
|
||||
half3 objNormal : NORMAL;\
|
||||
fixed4 v_color : COLOR;
|
||||
#define DC_UVFREE_TRANSFER(output,tex)\
|
||||
output.vertex = v.vertex;\
|
||||
_DC_UVFREE_WORLD_POS_TRANSFER(output)\
|
||||
output.objNormal = v.normal;\
|
||||
output.v_color=lerp(fixed4(1,1,1,1),v.color,_VertexColorPower);
|
||||
#define DC_UNFREE_VERTEX_ALPHA(input_color) input_color.a*=i.v_color.a;
|
||||
#define DC_UVFREE_FINAL(input,col) col.rgb*=input.v_color.rgb;
|
||||
#else
|
||||
#define DC_UVFREE_VCOLOR
|
||||
#define DC_UVFREE_INPUT
|
||||
#define DC_UVFREE_OUPUT(id1,id2)\
|
||||
float4 vertex : VERTEX;\
|
||||
_DC_UVFREE_WORLD_POS\
|
||||
half3 objNormal : NORMAL;
|
||||
#define DC_UVFREE_TRANSFER(output,tex)\
|
||||
output.vertex = v.vertex;\
|
||||
_DC_UVFREE_WORLD_POS_TRANSFER(output)\
|
||||
output.objNormal = v.normal;
|
||||
#define DC_UNFREE_VERTEX_ALPHA
|
||||
#define DC_UVFREE_FINAL(input,col)
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f8dc8469530c4ff79615b2161d039d5
|
||||
timeCreated: 1474187647
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user