files
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f09602f3a6b7405ea7442b35c2a4fbb
|
||||
folderAsset: yes
|
||||
timeCreated: 1468815682
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d03878683a68041af88d924c2e79de2f
|
||||
timeCreated: 1473226195
|
||||
licenseType: Store
|
||||
PluginImporter:
|
||||
serializedVersion: 1
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
@@ -0,0 +1,57 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5e24a42b35314313b7e868962e68ee8
|
||||
timeCreated: 1472715304
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 592f517a928434ee38226db6765777f6
|
||||
folderAsset: yes
|
||||
timeCreated: 1468815694
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 111b1c413faca4ef9ae0b42a3cbf23c7
|
||||
folderAsset: yes
|
||||
timeCreated: 1476081269
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,115 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Projector-Material
|
||||
m_Shader: {fileID: 4800000, guid: 8d43f3e027a044774ba58c9c8626f45f, type: 3}
|
||||
m_ShaderKeywords: _EMISSION _SHADE_ON _UVFREE_DOWN_NONE _UVFREE_UP_NONE _UVFREE_UV_FREE
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTexBottom:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 2, y: 2}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTexTop:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ProjectorFalloffTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ProjectorTex:
|
||||
m_Texture: {fileID: 2800000, guid: 231f337e2f9e74ee4be704d009f49a7a, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ShadeTex:
|
||||
m_Texture: {fileID: 8900000, guid: 3479905d2afba40e59f668c77312b2ce, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _Ambient: 0
|
||||
- _AmbientPower: 1
|
||||
- _Bottom: 0
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _Diffuse: 0
|
||||
- _DiffusePower: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _PowerBottom: 0.786
|
||||
- _PowerTop: 0
|
||||
- _Shade: 1
|
||||
- _ShadePower: 1
|
||||
- _Shadow: 0
|
||||
- _ShadowPower: 0.2
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Top: 0
|
||||
- _UVFREE_UV: 0
|
||||
- _UVSec: 0
|
||||
- _UVSpace: 0
|
||||
- _VertexColor: 0
|
||||
- _VertexColorPower: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorBottom: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorTop: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ShadeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c010b36dad694e389e0b35bf350784c
|
||||
timeCreated: 1476259808
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1000012511090030}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1000012511090030
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4000013342182990}
|
||||
- component: {fileID: 119000011956960372}
|
||||
m_Layer: 11
|
||||
m_Name: Projector-Template
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4000013342182990
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000012511090030}
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
|
||||
m_LocalPosition: {x: -0.049, y: 1.896, z: -0.019}
|
||||
m_LocalScale: {x: 1.0000001, y: 1.0000002, z: 1.0000002}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!119 &119000011956960372
|
||||
Projector:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1000012511090030}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_NearClipPlane: 0.1
|
||||
m_FarClipPlane: 2
|
||||
m_FieldOfView: 60
|
||||
m_AspectRatio: 1
|
||||
m_Orthographic: 1
|
||||
m_OrthographicSize: 1
|
||||
m_Material: {fileID: 2100000, guid: 6c010b36dad694e389e0b35bf350784c, type: 2}
|
||||
m_IgnoreLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aac72b8de5dcb4e2ba148db702c0cdd5
|
||||
timeCreated: 1476344065
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 175d9e3e3cc7d40229d2dc76475c801c
|
||||
folderAsset: yes
|
||||
timeCreated: 1468815658
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ce9ff13ebda6473f95ea941e5534cb7
|
||||
folderAsset: yes
|
||||
timeCreated: 1472188275
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec5e580f3463e45d0ba493d040490eaf
|
||||
folderAsset: yes
|
||||
timeCreated: 1472184018
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,221 @@
|
||||
// Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
|
||||
// Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
|
||||
|
||||
// Simplified Bumped Specular shader. Differences from regular Bumped Specular one:
|
||||
// - no Main Color nor Specular Color
|
||||
// - specular lighting directions are approximated per vertex
|
||||
// - writes zero to alpha channel
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - no Deferred Lighting support
|
||||
// - no Lightmap support
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Projector/Bumped Specular (1 Directional Light)" {
|
||||
Properties {
|
||||
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
|
||||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
_ShininessTop ("_ShininessTop", Range (0.03, 1)) = 0.078125
|
||||
_ShininessBottom ("_ShininessBottom", Range (0.03, 1)) = 0.078125
|
||||
|
||||
_ProjectorTex ("Projector Texture", 2D) = "white" {}
|
||||
_ProjectorFalloffTex ("Falloff Texture", 2D) = "white" {}
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Offset -1, -1
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd halfasview novertexlights vertex:vert alpha
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten)
|
||||
{
|
||||
fixed diff = max (0, dot (s.Normal, lightDir));
|
||||
fixed nh = max (0, dot (s.Normal, halfDir));
|
||||
fixed spec = pow (nh, s.Specular*128) * s.Gloss;
|
||||
|
||||
fixed4 c;
|
||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
|
||||
c.a=s.Alpha;
|
||||
return c;
|
||||
}
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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 SurfaceOutput 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 = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_TEX_APPLY(c,_MainTex,_MainTex);
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
o.Specular = _Shininess;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
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_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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
|
||||
float pa = projectorColor.a*projectorFalloff.a;
|
||||
|
||||
o.Albedo = c.rgb;
|
||||
o.Gloss = c.a;
|
||||
o.Alpha = pa*c.a;
|
||||
o.Normal = n.rgb;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Mobile/VertexLit"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e159fc3483f974f68a54e394d5d0eaa2
|
||||
timeCreated: 1476342663
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _BumpMap: {instanceID: 0}
|
||||
- _MainTexTop: {instanceID: 0}
|
||||
- _MainTexBottom: {instanceID: 0}
|
||||
- _BumpMapTop: {instanceID: 0}
|
||||
- _BumpMapBottom: {instanceID: 0}
|
||||
- _ProjectorTex: {fileID: 2800000, guid: 995ffc3e6c2e34c7aab060fd76bd4359, type: 3}
|
||||
- _ProjectorFalloffTex: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,201 @@
|
||||
// Simplified Bumped Specular shader. Differences from regular Bumped Specular one:
|
||||
// - no Main Color nor Specular Color
|
||||
// - specular lighting directions are approximated per vertex
|
||||
// - writes zero to alpha channel
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - no Deferred Lighting support
|
||||
// - no Lightmap support
|
||||
// - supports ONLY 1 directional light. Other lights are completely ignored.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Bumped Specular (1 Directional Light)" {
|
||||
Properties {
|
||||
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
|
||||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
_ShininessTop ("_ShininessTop", Range (0.03, 1)) = 0.078125
|
||||
_ShininessBottom ("_ShininessBottom", Range (0.03, 1)) = 0.078125
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 250
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd halfasview novertexlights vertex:vert
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten)
|
||||
{
|
||||
fixed diff = max (0, dot (s.Normal, lightDir));
|
||||
fixed nh = max (0, dot (s.Normal, halfDir));
|
||||
fixed spec = pow (nh, s.Specular*128) * s.Gloss;
|
||||
|
||||
fixed4 c;
|
||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
|
||||
UNITY_OPAQUE_ALPHA(c.a);
|
||||
return c;
|
||||
}
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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 SurfaceOutput o) {
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_TEX_APPLY(c,_MainTex,_MainTex);
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
o.Specular = _Shininess;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
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_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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = c.a;
|
||||
o.Gloss = c.a;
|
||||
o.Normal = n.rgb;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Mobile/VertexLit"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91939e5f0d6b94e80bda2738690583bc
|
||||
timeCreated: 1472188367
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,223 @@
|
||||
// Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
|
||||
// Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
|
||||
|
||||
// Simplified Bumped Specular shader. Differences from regular Bumped Specular one:
|
||||
// - no Main Color nor Specular Color
|
||||
// - specular lighting directions are approximated per vertex
|
||||
// - writes zero to alpha channel
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - no Deferred Lighting support
|
||||
// - no Lightmap support
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Projector/Bumped Specular" {
|
||||
Properties {
|
||||
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
|
||||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
_ShininessTop ("_ShininessTop", Range (0.03, 1)) = 0.078125
|
||||
_ShininessBottom ("_ShininessBottom", Range (0.03, 1)) = 0.078125
|
||||
|
||||
_ProjectorTex ("Projector Texture", 2D) = "white" {}
|
||||
_ProjectorFalloffTex ("Falloff Texture", 2D) = "white" {}
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Offset -1, -1
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd halfasview interpolateview vertex:vert alpha
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
//#pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten)
|
||||
{
|
||||
fixed diff = max (0, dot (s.Normal, lightDir));
|
||||
fixed nh = max (0, dot (s.Normal, halfDir));
|
||||
fixed spec = pow (nh, s.Specular*128) * s.Gloss;
|
||||
|
||||
fixed4 c;
|
||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
|
||||
c.a=s.Alpha;
|
||||
return c;
|
||||
}
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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 SurfaceOutput 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 = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_TEX_APPLY(c,_MainTex,_MainTex);
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
o.Specular = _Shininess;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
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_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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
|
||||
float pa = projectorColor.a*projectorFalloff.a;
|
||||
|
||||
// o.Specular *=pc.a;
|
||||
o.Albedo = c.rgb;
|
||||
o.Gloss = c.a;
|
||||
o.Alpha = pa*c.a;
|
||||
o.Normal = n.rgb;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Mobile/VertexLit"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe9cdece8f8984a6a869eb346d92a995
|
||||
timeCreated: 1476342663
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _BumpMap: {instanceID: 0}
|
||||
- _MainTexTop: {instanceID: 0}
|
||||
- _MainTexBottom: {instanceID: 0}
|
||||
- _BumpMapTop: {instanceID: 0}
|
||||
- _BumpMapBottom: {instanceID: 0}
|
||||
- _ProjectorTex: {fileID: 2800000, guid: 995ffc3e6c2e34c7aab060fd76bd4359, type: 3}
|
||||
- _ProjectorFalloffTex: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,202 @@
|
||||
// Simplified Bumped Specular shader. Differences from regular Bumped Specular one:
|
||||
// - no Main Color nor Specular Color
|
||||
// - specular lighting directions are approximated per vertex
|
||||
// - writes zero to alpha channel
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - no Deferred Lighting support
|
||||
// - no Lightmap support
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Bumped Specular" {
|
||||
Properties {
|
||||
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
|
||||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
_ShininessTop ("_ShininessTop", Range (0.03, 1)) = 0.078125
|
||||
_ShininessBottom ("_ShininessBottom", Range (0.03, 1)) = 0.078125
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 250
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd halfasview interpolateview vertex:vert
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
//#pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten)
|
||||
{
|
||||
fixed diff = max (0, dot (s.Normal, lightDir));
|
||||
fixed nh = max (0, dot (s.Normal, halfDir));
|
||||
fixed spec = pow (nh, s.Specular*128) * s.Gloss;
|
||||
|
||||
fixed4 c;
|
||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
|
||||
UNITY_OPAQUE_ALPHA(c.a);
|
||||
return c;
|
||||
}
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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 SurfaceOutput o) {
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_TEX_APPLY(c,_MainTex,_MainTex);
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
o.Specular = _Shininess;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
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_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_LERP(o.Specular,_ShininessTop,ratio);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
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_LERP(o.Specular,_ShininessBottom,ratio);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
o.Albedo = c.rgb;
|
||||
o.Gloss = c.a;
|
||||
o.Alpha = c.a;
|
||||
o.Normal = n.rgb;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Mobile/VertexLit"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3dd76ae3f716f45a5aba69a756317ccf
|
||||
timeCreated: 1472188367
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,184 @@
|
||||
Shader "Digicrafts/UV-Free/Mobile/Projector/Bumped Diffuse" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
_ProjectorTex ("Projector Texture", 2D) = "white" {}
|
||||
_ProjectorFalloffTex ("Falloff Texture", 2D) = "white" {}
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Offset -1, -1
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert noforwardadd vertex:vert alpha
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
//#pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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)
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
void surf (Input i, inout SurfaceOutput 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 = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex)
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFTLEFT
|
||||
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);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
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);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
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);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
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);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
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_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);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
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);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
|
||||
float pa = projectorColor.a*projectorFalloff.a;
|
||||
|
||||
o.Normal = n.rgb;//*pc.a;//lerp(float3(0,0,1), n.rgb, pa);
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = pa*c.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d84ca1ee3f520440ea163a4cbf984a8a
|
||||
timeCreated: 1476342618
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _BumpMap: {instanceID: 0}
|
||||
- _MainTexTop: {instanceID: 0}
|
||||
- _MainTexBottom: {instanceID: 0}
|
||||
- _BumpMapTop: {instanceID: 0}
|
||||
- _BumpMapBottom: {instanceID: 0}
|
||||
- _ProjectorTex: {fileID: 2800000, guid: 995ffc3e6c2e34c7aab060fd76bd4359, type: 3}
|
||||
- _ProjectorFalloffTex: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,173 @@
|
||||
// Simplified Bumped shader. Differences from regular Bumped one:
|
||||
// - no Main Color
|
||||
// - Normalmap uses Tiling/Offset of the Base texture
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Bumped Diffuse" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 250
|
||||
//ZWrite On
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert noforwardadd vertex:vert //alpha
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
//#pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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)
|
||||
}
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
void surf (Input i, inout SurfaceOutput o) {
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex)
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
fixed3 n = fixed3(1,1,1);
|
||||
DC_UVFREE_SCALE_NORMAL_APPLY(n,_BumpMap,_MainTex,_BumpScale);
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFTLEFT
|
||||
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);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
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);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
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);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
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);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
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_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);
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
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);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
o.Normal = n.rgb;
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = c.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
//FallBack "Mobile/Diffuse"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c9e4b9b346884ab48e78836e56a62ad
|
||||
timeCreated: 1472188367
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,151 @@
|
||||
// Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
|
||||
// Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
|
||||
|
||||
// Simplified Diffuse shader. Differences from regular Diffuse one:
|
||||
// - no Main Color
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Projector/Diffuse" {
|
||||
Properties {
|
||||
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_ProjectorTex ("Projector Texture", 2D) = "white" {}
|
||||
_ProjectorFalloffTex ("Falloff Texture", 2D) = "white" {}
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Offset -1, -1
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert noforwardadd vertex:vert alpha
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
//#pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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 SurfaceOutput 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 = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
float pa = projectorColor.a*projectorFalloff.a;
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = pa*c.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Fallback "Mobile/VertexLit"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 668ce533ebee5410a831688de722cd9e
|
||||
timeCreated: 1475643340
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,132 @@
|
||||
// Simplified Diffuse shader. Differences from regular Diffuse one:
|
||||
// - no Main Color
|
||||
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
|
||||
|
||||
Shader "Digicrafts/UV-Free/Mobile/Diffuse" {
|
||||
Properties {
|
||||
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 150
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert noforwardadd vertex:vert alpha
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
//#pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform fixed4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
struct Input {
|
||||
float4 vertex;
|
||||
float3 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 SurfaceOutput o) {
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
o.Albedo = c.rgb;
|
||||
o.Alpha = c.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Fallback "Mobile/VertexLit"
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec87b96573b3a4fd7ae638b09de431df
|
||||
timeCreated: 1472184139
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3353f5a4d64fe4a0da20948b83f05255
|
||||
folderAsset: yes
|
||||
timeCreated: 1472366651
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
Shader "Digicrafts/UV-Free/Standard/Standard" {
|
||||
Properties {
|
||||
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
_MainTex("Albedo", 2D) = "white" {}
|
||||
|
||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
_MetallicGlossMap("Metallic", 2D) = "white" {}
|
||||
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_BumpMap("Normal Map", 2D) = "bump" {}
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_GlossinessTop("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
[Gamma] _MetallicTop("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
_MetallicGlossMapTop("Metallic", 2D) = "white" {}
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
|
||||
_GlossinessBottom("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
[Gamma] _MetallicBottom("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
_MetallicGlossMapBottom("Metallic", 2D) = "white" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
// _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
|
||||
// _OcclusionMap("Occlusion", 2D) = "white" {}
|
||||
// _OcclusionStrengthTop("Strength", Range(0.0, 1.0)) = 1.0
|
||||
// _OcclusionMapTop("Occlusion", 2D) = "white" {}
|
||||
// _OcclusionStrengthBottom("Strength", Range(0.0, 1.0)) = 1.0
|
||||
// _OcclusionMapBottom("Occlusion", 2D) = "white" {}
|
||||
|
||||
// Blending state
|
||||
[HideInInspector] _Mode ("__mode", Float) = 0.0
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _ZWrite ("__zw", Float) = 1.0
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
|
||||
LOD 300
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
ZWrite [_ZWrite]
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Standard vertex:vert
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
|
||||
// Standard shader feature variants
|
||||
#pragma shader_feature _NORMALMAP
|
||||
#pragma shader_feature _METALLICGLOSSMAP
|
||||
#pragma shader_feature _METALLICGLOSSMAP_TOP
|
||||
#pragma shader_feature _METALLICGLOSSMAP_BOTTOM
|
||||
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeVertexColor.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeStandardNoOcc.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeMain.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeStandardMetallic.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeStandard.cginc"
|
||||
|
||||
|
||||
ENDCG
|
||||
}
|
||||
Fallback "Diffuse"
|
||||
CustomEditor "UVFreeStandardShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 303251a2c62c040998add69284c481f0
|
||||
timeCreated: 1472637690
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
Shader "Digicrafts/UV-Free/Standard/Standard (Specular)" {
|
||||
Properties {
|
||||
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
_MainTex("Albedo", 2D) = "white" {}
|
||||
|
||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_SpecColor("Specular", Color) = (0.2,0.2,0.2)
|
||||
_SpecGlossMap("Specular", 2D) = "white" {}
|
||||
|
||||
_BumpScale("Scale", Float) = 1.0
|
||||
_BumpMap("Normal Map", 2D) = "bump" {}
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_GlossinessTop("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_SpecColorTop("Specular", Color) = (0.2,0.2,0.2)
|
||||
_SpecGlossMapTop("Specular", 2D) = "white" {}
|
||||
_BumpScaleTop("Scale", Float) = 1.0
|
||||
_BumpMapTop ("_BumpMapTop", 2D) = "bump" {}
|
||||
|
||||
_GlossinessBottom("Smoothness", Range(0.0, 1.0)) = 0.5
|
||||
_SpecColorBottom("Specular", Color) = (0.2,0.2,0.2)
|
||||
_SpecGlossMapBottom("Specular", 2D) = "white" {}
|
||||
_BumpScaleBottom("Scale", Float) = 1.0
|
||||
_BumpMapBottom ("_BumpMapBottom", 2D) = "bump" {}
|
||||
|
||||
// Blending state
|
||||
[HideInInspector] _Mode ("__mode", Float) = 0.0
|
||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||
[HideInInspector] _ZWrite ("__zw", Float) = 1.0
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
|
||||
LOD 300
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
ZWrite [_ZWrite]
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf StandardSpecular vertex:vert
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
|
||||
// Standard shader feature variants
|
||||
#pragma shader_feature _NORMALMAP
|
||||
#pragma shader_feature _SPECGLOSSMAP
|
||||
#pragma shader_feature _SPECGLOSSMAP_TOP
|
||||
#pragma shader_feature _SPECGLOSSMAP_BOTTOM
|
||||
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeVertexColor.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeStandardNoOcc.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeMain.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeStandardSpecular.cginc"
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeStandard.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
CustomEditor "UVFreeStandardShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93fe439b3f5ac447fb4ebb8ca3a00bc5
|
||||
timeCreated: 1472958171
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d3d20eb00a824621a0dfd301658e111
|
||||
folderAsset: yes
|
||||
timeCreated: 1472216996
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,318 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
|
||||
// Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
|
||||
|
||||
Shader "Digicrafts/UV-Free/Toon/Outline-Projector"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("_MainTex", 2D) = "white" {}
|
||||
_Color ("_Color", Color) = (1,1,1,1)
|
||||
// _OutlineColor ("_OutlineColor", Color) = (0,0,0,0)
|
||||
// _OutlineWidth ("_OutlineWidth", Range (0, 10)) = 0.5
|
||||
[Toggle] _Shade ("Eanble", Float) = 1
|
||||
_ShadeTex ("_ShadeTex", CUBE) = "gray" {}
|
||||
_ShadePower ("_ShadePower",Range(0,1)) = 1
|
||||
_ShadeColor ("_ShadeColor", Color) = (1,1,1,1)
|
||||
[Toggle] _Shadow ("_Shadow", Float) = 0
|
||||
_ShadowPower ("_ShadowPower",Range(0,1)) = 0.2
|
||||
[Toggle] _Diffuse ("_Diffuse", Float) = 0
|
||||
_DiffusePower ("_DiffusePower",Range(0,1)) = 1
|
||||
[Toggle] _Ambient ("_Ambient", Float) = 0
|
||||
_AmbientPower ("_AmbientPower",Range(0,1)) = 1
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_ProjectorTex ("Projector Texture", 2D) = "white" {}
|
||||
_ProjectorFalloffTex ("Falloff Texture", 2D) = "white" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// base
|
||||
Pass
|
||||
{
|
||||
Name "BASE"
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Offset -1, -1
|
||||
LOD 100
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
// make fog work
|
||||
#pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight alpha
|
||||
#pragma multi_compile_fog
|
||||
#pragma shader_feature _DIFFUSE_ON
|
||||
#pragma multi_compile _AMBIENT_ON
|
||||
#pragma shader_feature _SHADOW_ON
|
||||
#pragma shader_feature _SHADE_ON
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
// #pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
#if _DIFFUSE_ON
|
||||
uniform fixed4 _DiffuseColor;
|
||||
uniform float _DiffusePower;
|
||||
#endif
|
||||
|
||||
// #if _AMBIENT_ON
|
||||
uniform float _AmbientPower;
|
||||
// #endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
uniform fixed4 _ShadowColor;
|
||||
uniform fixed _ShadowPower;
|
||||
#endif
|
||||
|
||||
#if _SHADE_ON
|
||||
samplerCUBE _ShadeTex;
|
||||
uniform fixed _ShadePower;
|
||||
uniform fixed _SpecToonEffectPower;
|
||||
uniform fixed3 _ShadeColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
DC_UVFREE_INPUT
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
|
||||
#if _DIFFUSE_ON
|
||||
fixed3 diff : COLOR1;
|
||||
#endif
|
||||
|
||||
// #if _AMBIENT_ON
|
||||
fixed3 ambient : COLOR2;
|
||||
// #endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
SHADOW_COORDS(3)
|
||||
#endif
|
||||
|
||||
#if _SHADE_ON
|
||||
float3 cubenormal : NORMAL1;
|
||||
#endif
|
||||
|
||||
UNITY_FOG_COORDS(5)
|
||||
DC_UVFREE_OUPUT(6,7)
|
||||
|
||||
float4 projector : TEXCOORD8;
|
||||
float4 projectorFalloff : TEXCOORD9;
|
||||
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
|
||||
#if _SHADE_ON
|
||||
o.cubenormal = mul (UNITY_MATRIX_MV, float4(v.normal,0));
|
||||
#endif
|
||||
|
||||
#if _DIFFUSE_ON
|
||||
half nl = max(0, dot(UnityObjectToWorldNormal(o.objNormal), _WorldSpaceLightPos0.xyz));
|
||||
o.diff = nl * _LightColor0 * _DiffusePower;
|
||||
#endif
|
||||
|
||||
// #if _AMBIENT_ON
|
||||
o.ambient = ShadeSH9(half4(UnityObjectToWorldNormal(o.objNormal),1)) * _AmbientPower;
|
||||
// #endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
TRANSFER_SHADOW(o)
|
||||
#endif
|
||||
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
|
||||
o.projector = mul (unity_Projector, v.vertex);
|
||||
o.projectorFalloff = mul (unity_ProjectorClip, v.vertex);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 projectorColor = tex2Dproj (_ProjectorTex, UNITY_PROJ_COORD(i.projector));
|
||||
fixed4 projectorFalloff = tex2Dproj (_ProjectorFalloffTex, UNITY_PROJ_COORD(i.projectorFalloff));
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if _SHADOW_ON
|
||||
fixed shadow = clamp(SHADOW_ATTENUATION(i)+1-_ShadowPower,0,1);
|
||||
#if _SHADOWTOONEFFECT_ON
|
||||
shadow = round(shadow*_ShadowToonEffectPower)/_ShadowToonEffectPower;
|
||||
#endif
|
||||
#else
|
||||
fixed shadow = 1;
|
||||
#endif
|
||||
|
||||
#if _SHADE_ON
|
||||
fixed4 cube = clamp(texCUBE(_ShadeTex, i.cubenormal),(1-_ShadePower),1);
|
||||
c.rgb = cube.rgb*c.rgb;//lerp(fixed4(0,0,0,0),_ShadeColor
|
||||
#endif
|
||||
|
||||
#if _DIFFUSE_ON && _AMBIENT_ON
|
||||
c.rgb=c.rgb*i.diff*shadow+i.ambient;
|
||||
#else
|
||||
#if _DIFFUSE_ON
|
||||
c.rgb*=i.diff*shadow;
|
||||
#else
|
||||
#if _AMBIENT_ON
|
||||
c.rgb=c.rgb*shadow+i.ambient;
|
||||
#else
|
||||
c.rgb=c.rgb*shadow;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
c.rgb = c.rgb + (1-shadow)*_ShadowColor.rgb*_ShadowPower;
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c)
|
||||
UNITY_APPLY_FOG(i.fogCoord,c);
|
||||
|
||||
float kkk = projectorColor.a*projectorFalloff.a;
|
||||
c = lerp(fixed4(1,1,1,0), c, projectorColor.a*projectorFalloff.a);
|
||||
|
||||
return c;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// shadow pass
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
CustomEditor "UVFreeToonShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6761f4a7963b54fe5a050ac6da524560
|
||||
timeCreated: 1476342875
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _ShadeTex: {instanceID: 0}
|
||||
- _MainTexTop: {instanceID: 0}
|
||||
- _MainTexBottom: {instanceID: 0}
|
||||
- _ProjectorTex: {fileID: 2800000, guid: 995ffc3e6c2e34c7aab060fd76bd4359, type: 3}
|
||||
- _ProjectorFalloffTex: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,351 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "Digicrafts/UV-Free/Toon/Outline"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
_OutlineColor ("Outline Color", Color) = (0,0,0,0)
|
||||
_OutlineWidth ("Outline Width", Range (0, 10)) = 0.5
|
||||
[Toggle] _Shade ("Eanble", Float) = 1
|
||||
_ShadeTex ("Texture", CUBE) = "gray" {}
|
||||
_ShadePower ("Power",Range(0,1)) = 1
|
||||
_ShadeColor ("Outline Color", Color) = (1,1,1,1)
|
||||
[Toggle] _Shadow ("Eanble", Float) = 0
|
||||
_ShadowPower ("Shadow Power",Range(0,1)) = 0.2
|
||||
[Toggle] _Diffuse ("Diffuse", Float) = 0
|
||||
_DiffusePower ("Power",Range(0,1)) = 1
|
||||
[Toggle] _Ambient ("Ambient", Float) = 0
|
||||
_AmbientPower ("Power",Range(0,1)) = 1
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// Outline pass
|
||||
Pass
|
||||
{
|
||||
Name "OUTLINE"
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#include "UnityCG.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
uniform fixed _OutlineWidth;
|
||||
uniform fixed4 _OutlineColor;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : POSITION;
|
||||
float4 color : COLOR;
|
||||
UNITY_FOG_COORDS(0)
|
||||
};
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
if(_OutlineWidth!=0){
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
|
||||
float2 offset = normalize(TransformViewToProjection(norm.xy));
|
||||
float ortho = 100;
|
||||
float persp = 10;
|
||||
if(UNITY_MATRIX_P[3][3]==0){
|
||||
o.pos.xy += offset * _OutlineWidth / persp;
|
||||
}else{
|
||||
o.pos.xy += offset * _OutlineWidth / ortho;
|
||||
}
|
||||
} else {
|
||||
o.pos = fixed4(0,0,0,0);
|
||||
o.color = _OutlineColor;
|
||||
}
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) :COLOR
|
||||
{
|
||||
fixed4 c = fixed4(i.color.rgb,i.color.a);
|
||||
UNITY_APPLY_FOG(i.fogCoord,c);
|
||||
return c;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
// base
|
||||
Pass
|
||||
{
|
||||
Name "BASE"
|
||||
Tags {
|
||||
"LightMode"="ForwardBase"
|
||||
"RenderType"="Opaque"
|
||||
}
|
||||
LOD 100
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
// make fog work
|
||||
#pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight
|
||||
#pragma multi_compile_fog
|
||||
#pragma shader_feature _DIFFUSE_ON
|
||||
#pragma shader_feature _AMBIENT_ON
|
||||
#pragma shader_feature _SHADOW_ON
|
||||
#pragma shader_feature _SHADE_ON
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
// #pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
#if _DIFFUSE_ON
|
||||
uniform fixed4 _DiffuseColor;
|
||||
uniform float _DiffusePower;
|
||||
#endif
|
||||
|
||||
#if _AMBIENT_ON
|
||||
uniform float _AmbientPower;
|
||||
#endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
uniform fixed4 _ShadowColor;
|
||||
uniform fixed _ShadowPower;
|
||||
#endif
|
||||
|
||||
#if _SHADE_ON
|
||||
samplerCUBE _ShadeTex;
|
||||
uniform fixed _ShadePower;
|
||||
uniform fixed _SpecToonEffectPower;
|
||||
uniform fixed3 _ShadeColor;
|
||||
#endif
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
DC_UVFREE_INPUT
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
|
||||
#if _DIFFUSE_ON
|
||||
fixed3 diff : COLOR1;
|
||||
#endif
|
||||
|
||||
#if _AMBIENT_ON
|
||||
fixed3 ambient : COLOR2;
|
||||
#endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
SHADOW_COORDS(3)
|
||||
#endif
|
||||
|
||||
#if _SHADE_ON
|
||||
float3 cubenormal : NORMAL1;
|
||||
#endif
|
||||
|
||||
UNITY_FOG_COORDS(5)
|
||||
|
||||
DC_UVFREE_OUPUT(6,7)
|
||||
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
|
||||
#if _SHADE_ON
|
||||
o.cubenormal = mul (UNITY_MATRIX_MV, float4(v.normal,0));
|
||||
#endif
|
||||
|
||||
#if _DIFFUSE_ON
|
||||
half nl = max(0, dot(UnityObjectToWorldNormal(o.objNormal), _WorldSpaceLightPos0.xyz));
|
||||
o.diff = nl * _LightColor0 * _DiffusePower;
|
||||
#endif
|
||||
|
||||
#if _AMBIENT_ON
|
||||
o.ambient = ShadeSH9(half4(o.worldNormal,1)) * _AmbientPower;
|
||||
#endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
TRANSFER_SHADOW(o)
|
||||
#endif
|
||||
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if _SHADOW_ON
|
||||
fixed shadow = clamp(SHADOW_ATTENUATION(i)+1-_ShadowPower,0,1);
|
||||
#if _SHADOWTOONEFFECT_ON
|
||||
shadow = round(shadow*_ShadowToonEffectPower)/_ShadowToonEffectPower;
|
||||
#endif
|
||||
#else
|
||||
fixed shadow = 1;
|
||||
#endif
|
||||
|
||||
#if _SHADE_ON
|
||||
fixed4 cube = clamp(texCUBE(_ShadeTex, i.cubenormal),(1-_ShadePower),1);
|
||||
c.rgb = cube.rgb*c.rgb;//lerp(fixed4(0,0,0,0),_ShadeColor
|
||||
#endif
|
||||
|
||||
#if _DIFFUSE_ON && _AMBIENT_ON
|
||||
c.rgb=c.rgb*i.diff*shadow+i.ambient;
|
||||
#else
|
||||
#if _DIFFUSE_ON
|
||||
c.rgb*=i.diff*shadow;
|
||||
#else
|
||||
#if _AMBIENT_ON
|
||||
c.rgb=c.rgb*shadow+i.ambient;
|
||||
#else
|
||||
c.rgb=c.rgb*shadow;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _SHADOW_ON
|
||||
c.rgb = c.rgb + (1-shadow)*_ShadowColor.rgb*_ShadowPower;
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c)
|
||||
UNITY_APPLY_FOG(i.fogCoord,c);
|
||||
|
||||
return c;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// shadow pass
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
CustomEditor "UVFreeToonShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81980bb3afbce4292a38430ebf6f52dd
|
||||
timeCreated: 1472264688
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b936a54c6cf904ca4ab675138da9b6c4
|
||||
folderAsset: yes
|
||||
timeCreated: 1472216996
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,152 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Unlit alpha-blended shader.
|
||||
// - no lighting
|
||||
// - no lightmap support
|
||||
// - no per-material color
|
||||
|
||||
Shader "Digicrafts/UV-Free/Unlit/Transparent" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
|
||||
LOD 100
|
||||
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
// #pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
DC_UVFREE_INPUT
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
DC_UVFREE_OUPUT(1,2)
|
||||
UNITY_FOG_COORDS(3)
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
UNITY_APPLY_FOG(i.fogCoord, c);
|
||||
return c;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2dcbbb7d9460443f78f12e27e48198a3
|
||||
timeCreated: 1472264688
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,154 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Unlit alpha-cutout shader.
|
||||
// - no lighting
|
||||
// - no lightmap support
|
||||
// - no per-material color
|
||||
|
||||
Shader "Digicrafts/UV-Free/Unlit/Transparent Cutout" {
|
||||
Properties {
|
||||
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
}
|
||||
SubShader {
|
||||
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
|
||||
LOD 100
|
||||
|
||||
Lighting Off
|
||||
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
// #pragma shader_feature _UVFREE_UV_FREE _UVFREE_UV_UV0 _UVFREE_UV_UV1
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
uniform fixed _Cutoff;
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
DC_UVFREE_INPUT
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
DC_UVFREE_OUPUT(1,2)
|
||||
UNITY_FOG_COORDS(3)
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
clip(c.a - _Cutoff);
|
||||
DC_UVFREE_FINAL(i,c.rgb)
|
||||
UNITY_APPLY_FOG(i.fogCoord, c);
|
||||
return c;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef0b42d7a3cf74526bb32e6ec78361a2
|
||||
timeCreated: 1472264688
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,153 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Unlit shader. Simplest possible textured shader.
|
||||
// - no lighting
|
||||
// - no lightmap support
|
||||
// - no per-material color
|
||||
Shader "Digicrafts/UV-Free/Unlit/Texture" {
|
||||
Properties {
|
||||
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
#include "../Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
DC_UVFREE_INPUT
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
DC_UVFREE_OUPUT(1,2)
|
||||
UNITY_FOG_COORDS(3)
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
// #if _UVFREE_VERTEX_COLOR
|
||||
// fixed4 c = fixed4(i.v_color.a,i.v_color.a,i.v_color.a,1);
|
||||
// #else
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
// #endif
|
||||
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
DC_UVFREE_FINAL(i,c)
|
||||
UNITY_APPLY_FOG(i.fogCoord, c);
|
||||
UNITY_OPAQUE_ALPHA(c.a);
|
||||
return c;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 488c491f0a9dd44a3ae6abd65f562502
|
||||
timeCreated: 1472216996
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,170 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
// Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
|
||||
// Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
|
||||
|
||||
// Unlit shader. Simplest possible textured shader.
|
||||
// - no lighting
|
||||
// - no lightmap support
|
||||
// - no per-material color
|
||||
Shader "Digicrafts/UV-Free/Unlit/Projector" {
|
||||
Properties {
|
||||
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
_Color ("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
// UV-Free Properties
|
||||
[Toggle(_UVFREE_WORLDSPACE)] _UVSpace ("_UVSpace", Float) = 0
|
||||
[KeywordEnum(Free,UV0,UV1)] _UVFREE_UV ("_UVFREE_UV", Float) = 0
|
||||
[Toggle(_UVFREE_VERTEX_COLOR)] _VertexColor ("_VertexColor", Float) = 0
|
||||
_VertexColorPower ("_VertexColorPower", Range(0,5)) = 1
|
||||
|
||||
_Top ("_Top", Float) = 0
|
||||
_PowerTop ("_PowerTop", Range(0,1)) = 0.5
|
||||
_ColorTop ("_ColorTop", Color) = (1,1,1,1)
|
||||
_MainTexTop ("_MainTexTop", 2D) = "white" {}
|
||||
|
||||
_Bottom ("_Bottom", Float) = 0
|
||||
_PowerBottom ("_PowerBottom", Range(0,1)) = 0.5
|
||||
_ColorBottom ("_ColorBottom", Color) = (1,1,1,1)
|
||||
_MainTexBottom ("_MainTexBottom", 2D) = "white" {}
|
||||
|
||||
_ProjectorTex ("Projector Texture", 2D) = "white" {}
|
||||
_ProjectorFalloffTex ("Falloff Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Offset -1, -1
|
||||
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#pragma shader_feature _UVFREE_UP_NONE _UVFREE_UP_TOP _UVFREE_UP_FRONT _UVFREE_UP_LEFT
|
||||
#pragma shader_feature _UVFREE_DOWN_NONE _UVFREE_DOWN_BOTTOM _UVFREE_DOWN_BACK _UVFREE_DOWN_RIGHT
|
||||
#pragma shader_feature _UVFREE_WORLDSPACE
|
||||
#pragma shader_feature _UVFREE_VERTEX_COLOR
|
||||
#include "Assets/Digicrafts/UVFree/Shaders/Core/UVFreeCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform fixed4 _Color;
|
||||
|
||||
uniform sampler2D _ProjectorTex;
|
||||
uniform sampler2D _ProjectorFalloffTex;
|
||||
uniform float4x4 unity_Projector;
|
||||
uniform float4x4 unity_ProjectorClip;
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
DC_UVFREE_INPUT
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
DC_UVFREE_OUPUT(1,2)
|
||||
UNITY_FOG_COORDS(3)
|
||||
float4 projector : TEXCOORD3;
|
||||
float4 projectorFalloff : TEXCOORD4;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
DC_UVFREE_TRANSFER(o,_MainTex)
|
||||
UNITY_TRANSFER_FOG(o,o.pos);
|
||||
o.projector = mul (unity_Projector, v.vertex);
|
||||
o.projectorFalloff = mul (unity_ProjectorClip, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 projectorColor = tex2Dproj (_ProjectorTex, UNITY_PROJ_COORD(i.projector));
|
||||
fixed4 projectorFalloff = tex2Dproj (_ProjectorFalloffTex, UNITY_PROJ_COORD(i.projectorFalloff));
|
||||
|
||||
DC_UVFREE_SETUP(i.objNormal)
|
||||
fixed4 c = fixed4(1,1,1,1);
|
||||
|
||||
DC_UVFREE_UV_APPLY(i,_MainTex);
|
||||
DC_UVFREE_APPLY_MAIN_TEX(c)
|
||||
c*=_Color;
|
||||
|
||||
// Add top/bottom
|
||||
#if _UVFREE_UP_LEFT || _UVFREE_DOWN_RIGHT
|
||||
if(uv_normal.x>0){
|
||||
#if _UVFREE_UP_LEFT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_X(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_RIGHT
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_X(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_FRONT || _UVFREE_DOWN_BACK
|
||||
if(uv_normal.z>0){
|
||||
#if _UVFREE_UP_FRONT
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Z(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BACK
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Z(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _UVFREE_UP_TOP || _UVFREE_DOWN_BOTTOM
|
||||
if(uv_normal.y>0){
|
||||
#if _UVFREE_UP_TOP
|
||||
fixed4 top_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexTop);
|
||||
DC_UVFREE_TEX_APPLY_LOD(top_c,_MainTexTop,_MainTexTop);
|
||||
DC_UVFREE_VALUE_Y(c,(top_c*_ColorTop),_PowerTop);
|
||||
#endif
|
||||
} else {
|
||||
#if _UVFREE_DOWN_BOTTOM
|
||||
fixed4 bottom_c = fixed4(1,1,1,1);
|
||||
DC_UVFREE_UV_APPLY(i,_MainTexBottom);
|
||||
DC_UVFREE_TEX_APPLY_LOD(bottom_c,_MainTexBottom,_MainTexBottom);
|
||||
DC_UVFREE_VALUE_Y(c,(bottom_c*_ColorBottom),_PowerBottom);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
DC_UVFREE_FINAL(i,c)
|
||||
UNITY_APPLY_FOG(i.fogCoord, c);
|
||||
|
||||
c = lerp(fixed4(1,1,1,0), c, projectorColor.a*projectorFalloff.a);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "UVFreeMobileShaderGUI"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d43f3e027a044774ba58c9c8626f45f
|
||||
timeCreated: 1476259922
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _MainTexTop: {instanceID: 0}
|
||||
- _MainTexBottom: {instanceID: 0}
|
||||
- _ProjectorTex: {fileID: 2800000, guid: 231f337e2f9e74ee4be704d009f49a7a, type: 3}
|
||||
- _ProjectorFalloffTex: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: feb1c2982215c4c2883720065c31b18c
|
||||
folderAsset: yes
|
||||
timeCreated: 1472032276
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd18f0001d5be493da763c36cb8cdf5b
|
||||
timeCreated: 1473259904
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user