第一次提交
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07b55297904a4424e8e09d3132f6be89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,467 @@
|
||||
|
||||
Shader "Hidden/Amazing Assets/Terrain To Mesh/AllTerrainTextures"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("", Color) = (1, 1, 1, 1)
|
||||
_MainTex("", 2D) = "white" {}
|
||||
|
||||
_ControlMap ("", 2D) = "black" {}
|
||||
_ChannelIndex ("", float) = 4
|
||||
|
||||
_PaintDiffuseMap ("", 2D) = "white" {}
|
||||
_PaintNormalMap ("", 2D) = "bump" {}
|
||||
_PaintNormalScale("", float) = 1
|
||||
|
||||
_PaintMaskMap ("", 2D) = "white" {}
|
||||
|
||||
_PaintSpecular("", Color) = (1, 1, 1, 1)
|
||||
_PaintMetallic("", float) = 0
|
||||
_PaintSmoothness("", float) = 1
|
||||
_PaintSmoothnessFromDiffuseAlpha("", float) = 0
|
||||
|
||||
_PaintUVScaleOffset("", vector) = (1, 1, 0, 0)
|
||||
_PaintSplitUVOffset("", vector) = (1, 1, 0, 0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
|
||||
float4 _Color;
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize;
|
||||
|
||||
sampler2D _ControlMap;
|
||||
float _ChannelIndex;
|
||||
|
||||
sampler2D _PaintDiffuseMap;
|
||||
sampler2D _PaintNormalMap;
|
||||
float _PaintNormalClear;
|
||||
float _PaintNormalScale;
|
||||
|
||||
sampler2D _PaintMaskMap;
|
||||
float4 _PaintSpecular;
|
||||
float _PaintMetallic;
|
||||
float _PaintSmoothness;
|
||||
int _PaintSmoothnessFromDiffuseAlpha;
|
||||
float _PaintOccclusion;
|
||||
|
||||
float4 _MaskRemapMin;
|
||||
float4 _MaskRemapMax;
|
||||
|
||||
float4 _PaintUVScaleOffset;
|
||||
float4 _PaintSplitUVOffset;
|
||||
|
||||
float _FlipNormal;
|
||||
float _WorldSpaceUV;
|
||||
float2 _Remap01;
|
||||
|
||||
float _RotationDegree;
|
||||
float _GammaToLinear;
|
||||
|
||||
|
||||
float ControlValue(float2 uv)
|
||||
{
|
||||
if(_ChannelIndex < 0.5)
|
||||
return tex2D (_ControlMap, uv).r;
|
||||
else if(_ChannelIndex < 1.5)
|
||||
return tex2D (_ControlMap, uv).g;
|
||||
else if(_ChannelIndex < 2.5)
|
||||
return tex2D (_ControlMap, uv).b;
|
||||
else
|
||||
return tex2D (_ControlMap, uv).a;
|
||||
}
|
||||
|
||||
void TerrainToWorldUV(float2 uv, out float2 mapUV, out float2 controlUV)
|
||||
{
|
||||
_PaintUVScaleOffset.zw += _PaintUVScaleOffset.xy * _PaintSplitUVOffset.zw;
|
||||
_PaintUVScaleOffset.xy *= _PaintSplitUVOffset.xy;
|
||||
|
||||
mapUV = float2(uv * _PaintUVScaleOffset.xy + _PaintUVScaleOffset.zw);
|
||||
controlUV = float2(uv * _PaintSplitUVOffset.xy + _PaintSplitUVOffset.zw);
|
||||
|
||||
mapUV = lerp(mapUV, 1 - mapUV, _WorldSpaceUV);
|
||||
controlUV = lerp(controlUV, 1 - controlUV, _WorldSpaceUV);
|
||||
}
|
||||
|
||||
float2 RotateUV(float2 uv)
|
||||
{
|
||||
uv -= 0.5;
|
||||
float s = sin(_RotationDegree);
|
||||
float c = cos(_RotationDegree);
|
||||
float2x2 rMatrix = float2x2(c, -s, s, c);
|
||||
rMatrix *= 0.5;
|
||||
rMatrix += 0.5;
|
||||
rMatrix = rMatrix * 2 - 1;
|
||||
uv.xy = mul(uv.xy, rMatrix);
|
||||
uv += 0.5;
|
||||
|
||||
return uv;
|
||||
}
|
||||
|
||||
float Remap01(float value)
|
||||
{
|
||||
value = (value - _Remap01.x) * (1.0 / (_Remap01.y - _Remap01.x));
|
||||
|
||||
return saturate(value);
|
||||
}
|
||||
|
||||
float4 RemapMin01Max01(float4 value, float4 outMin, float4 outMax)
|
||||
{
|
||||
return outMin + value * (outMax - outMin);
|
||||
}
|
||||
|
||||
float3 HeightToNormal(float2 uv)
|
||||
{
|
||||
float2 uvOffset = _MainTex_TexelSize * 1;
|
||||
|
||||
|
||||
float K1 = Remap01(tex2D(_MainTex, uv + float2( uvOffset.x * -1, uvOffset.y)).r);
|
||||
float K2 = Remap01(tex2D(_MainTex, uv + float2( 0, uvOffset.y)).r);
|
||||
float K3 = Remap01(tex2D(_MainTex, uv + float2( uvOffset.x, uvOffset.y)).r);
|
||||
|
||||
float K4 = Remap01(tex2D(_MainTex, uv + float2( uvOffset.x * -1, 0)).r);
|
||||
float K5 = Remap01(tex2D(_MainTex, uv + float2( 0, 0)).r);
|
||||
float K6 = Remap01(tex2D(_MainTex, uv + float2( uvOffset.x, 0)).r);
|
||||
|
||||
float K7 = Remap01(tex2D(_MainTex, uv + float2( uvOffset.x * -1, uvOffset.y * -1)).r);
|
||||
float K8 = Remap01(tex2D(_MainTex, uv + float2( 0, uvOffset.y * -1)).r);
|
||||
float K9 = Remap01(tex2D(_MainTex, uv + float2( uvOffset.x, uvOffset.y * -1)).r);
|
||||
|
||||
|
||||
|
||||
|
||||
float3 n;
|
||||
n.x = 60 * (K9 - K7 + 2 * (K6 - K4) + K3 - K1) * -1;
|
||||
n.y = 60 * (K1 - K7 + 2 * (K2 - K8) + K3 - K9) * -1;
|
||||
n.z = 1.0;
|
||||
|
||||
if(_RotationDegree > 1)
|
||||
n.xy *= -1;
|
||||
|
||||
n = normalize(n);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float4 fragBasemapDiffuse(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + tex2D (_PaintDiffuseMap, mapUV) * _Color * float4(1, 1, 1, _PaintSmoothness) * ControlValue(controlUV);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapNormal(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
|
||||
float4 normal = tex2D (_PaintNormalMap, mapUV);
|
||||
if(_PaintNormalClear > 0.5)
|
||||
normal = float4(0.5f, 0.5f, 1, 1);
|
||||
|
||||
|
||||
//[-1, 1]
|
||||
normal = normal * 2 - 1;
|
||||
|
||||
//Flip normal
|
||||
normal.yw *= _PaintNormalScale * lerp(1, -1, _FlipNormal);
|
||||
|
||||
//[0, 1]
|
||||
normal = (normal + 1) / 2;
|
||||
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + normal * ControlValue(controlUV);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapNormalUnpacked(v2f_img i) : SV_Target
|
||||
{
|
||||
float4 c = tex2D(_MainTex, i.uv);
|
||||
|
||||
c.rgb = UnpackNormal(c) * 0.5 + 0.5;
|
||||
|
||||
c.rgb = lerp(c.rgb, 1 - c.rgb, _WorldSpaceUV);
|
||||
|
||||
|
||||
c.b = 1;
|
||||
c.a = 1;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapMask(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
float smoothnessValue = lerp(_PaintSmoothness, tex2D (_PaintDiffuseMap, mapUV).a, _PaintSmoothnessFromDiffuseAlpha);
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + RemapMin01Max01(tex2D (_PaintMaskMap, mapUV) * float4(_PaintMetallic, _PaintOccclusion, 0, smoothnessValue), _MaskRemapMin, _MaskRemapMax) * ControlValue(controlUV);
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapSpecular(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + float4(_PaintSpecular.rgb, 1) * float4(1, 1, 1, tex2D (_PaintDiffuseMap, mapUV).a * _PaintSmoothness) * ControlValue(controlUV);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapMetallic(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + float4(_PaintMetallic, 0, 0, tex2D (_PaintDiffuseMap, mapUV).a * _PaintSmoothness) * ControlValue(controlUV);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapSmoothness(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + float4(1, 0, 0, 1) * _PaintSmoothness * tex2D (_PaintDiffuseMap, mapUV).a * ControlValue(controlUV);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragBasemapOcclusion(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 mapUV, controlUV;
|
||||
TerrainToWorldUV(i.uv, mapUV, controlUV);
|
||||
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv) + float4(RemapMin01Max01(tex2D (_PaintMaskMap, mapUV) * float4(0, _PaintOccclusion, 0, 0), _MaskRemapMin, _MaskRemapMax).ggg, 1) * ControlValue(controlUV);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragGeneric(v2f_img i) : SV_Target
|
||||
{
|
||||
i.uv = RotateUV(i.uv);
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragGenericHolesmap(v2f_img i) : SV_Target
|
||||
{
|
||||
i.uv = RotateUV(i.uv);
|
||||
|
||||
float4 c = tex2D(_MainTex, i.uv);
|
||||
|
||||
return float4(c.xxx, 1);
|
||||
}
|
||||
|
||||
float4 fragGenericHeightmap(v2f_img i) : SV_Target
|
||||
{
|
||||
i.uv = RotateUV(i.uv);
|
||||
|
||||
float c = tex2D(_MainTex, i.uv);
|
||||
|
||||
|
||||
//Remap
|
||||
c.r = Remap01(c.r);
|
||||
|
||||
|
||||
if(_GammaToLinear > 0.5)
|
||||
c = GammaToLinearSpaceExact(c);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float4 fragGenericHeightmapNormal(v2f_img i) : SV_Target
|
||||
{
|
||||
i.uv = RotateUV(i.uv);
|
||||
|
||||
float3 c = HeightToNormal(i.uv);
|
||||
|
||||
c.rgb = (c) * 0.5 + 0.5;
|
||||
|
||||
return float4(c, 1);
|
||||
}
|
||||
|
||||
float4 fragHolesToBasemap(v2f_img i) : SV_Target
|
||||
{
|
||||
float4 c = tex2D(_MainTex, i.uv);
|
||||
float4 holes = tex2D(_ControlMap, i.uv);
|
||||
|
||||
c.a = holes.r;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass //0
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapDiffuse
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //1
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapNormal
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //2
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapNormalUnpacked
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //3
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapMask
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //4
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapSpecular
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //5
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapMetallic
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //6
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapSmoothness
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //7
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragBasemapOcclusion
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //8
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragGeneric
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //9
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragGenericHolesmap
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //10
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragGenericHeightmap
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //11
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragGenericHeightmapNormal
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
Pass //12
|
||||
{
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment fragHolesToBasemap
|
||||
ENDCG
|
||||
|
||||
} //Pass
|
||||
|
||||
} //SubShader
|
||||
|
||||
} //Shader
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b5d6711300837446955b62f25b46e9b
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Amazing Assets/Terrain To Mesh/Shaders/Grass.meta
Normal file
8
Assets/Amazing Assets/Terrain To Mesh/Shaders/Grass.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52339e50272993546a8bc0c40537b6dc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
||||
|
||||
// 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 "Mobile/Diffuse"
|
||||
|
||||
Shader "Amazing Assets/Terrain To Mesh/Grass"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base", 2D) = "white" {}
|
||||
_Cutoff ("Cutoff", float) = 0.5
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="TransparentCutout" "Queue"="AlphaTest"}
|
||||
LOD 150
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert noforwardadd addshadow nometa
|
||||
|
||||
sampler2D _MainTex;
|
||||
float _Cutoff;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
void surf (Input IN, inout SurfaceOutput o)
|
||||
{
|
||||
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
|
||||
|
||||
clip(c.a - _Cutoff * 1.01);
|
||||
|
||||
o.Albedo = c.rgb * IN.color.rgb * 2;
|
||||
o.Alpha = c.a;
|
||||
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6af8412c30ee4c9428ccab6193ed8830
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7ce2360b615b2242bde2167cf3f8c46
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 203af09763426b849863f19873323ef2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef VACUUM_SHADERS_T2M_DEFERRED_CGINC
|
||||
#define VACUUM_SHADERS_T2M_DEFERRED_CGINC
|
||||
|
||||
|
||||
|
||||
#include "../cginc/Core.cginc"
|
||||
|
||||
|
||||
void vert (inout appdata_full v, out Input o)
|
||||
{
|
||||
UNITY_INITIALIZE_OUTPUT(Input,o);
|
||||
|
||||
o.texcoord = v.texcoord.xy;
|
||||
|
||||
//Curved World
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
#ifdef CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
CURVEDWORLD_TRANSFORM_VERTEX_AND_NORMAL(v.vertex, v.normal, v.tangent)
|
||||
#else
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(v.vertex)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
#if defined(_ALPHATEST_ON)
|
||||
float holesmapValue = TerrainToMeshCalculateClipValue(IN.texcoord.xy);
|
||||
clip(holesmapValue - 0.5);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TERRAIN_TO_MESH_PASS_SHADOW_CASTER)
|
||||
|
||||
o.Albedo = 0;
|
||||
o.Alpha = 1;
|
||||
o.Normal = float3(0, 0, 1);
|
||||
o.Metallic = 0;
|
||||
o.Smoothness = 0;
|
||||
o.Occlusion = 1;
|
||||
|
||||
#else
|
||||
|
||||
TerrainToMeshCalculateLayersBlend(IN.texcoord.xy, o.Albedo, o.Alpha, o.Normal, o.Metallic, o.Smoothness, o.Occlusion);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d07730cc67dffd49af033f967d533a7
|
||||
timeCreated: 1446884875
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f64f1c0a2699f049b359df73c926832
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Amazing Assets/Terrain To Mesh/Shaders/cginc.meta
Normal file
8
Assets/Amazing Assets/Terrain To Mesh/Shaders/cginc.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9122b389a44ed6848aba905fce209b07
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
464
Assets/Amazing Assets/Terrain To Mesh/Shaders/cginc/Core.cginc
Normal file
464
Assets/Amazing Assets/Terrain To Mesh/Shaders/cginc/Core.cginc
Normal file
@@ -0,0 +1,464 @@
|
||||
#ifndef TERRAIN_TO_MESH_CORE_CGINC
|
||||
#define TERRAIN_TO_MESH_CORE_CGINC
|
||||
|
||||
|
||||
|
||||
#include "Variables.cginc"
|
||||
|
||||
|
||||
float4 TerrainToMeshRemap(float4 value, float4 outMin, float4 outMax)
|
||||
{
|
||||
return outMin + value * (outMax - outMin);
|
||||
}
|
||||
|
||||
//Unity_NormalStrength_float
|
||||
float3 TerrainToMeshNormalStrength(float3 In, float Strength)
|
||||
{
|
||||
return float3(In.rg * Strength, lerp(1, In.b, saturate(Strength)));
|
||||
}
|
||||
|
||||
#if defined(_T2M_TEXTURE_SAMPLE_TYPE_ARRAY)
|
||||
|
||||
#define T2M_UNPACK_SPLATMAP(uv,index) UNITY_SAMPLE_TEX2DARRAY(_T2M_SplatMaps2DArray, float3(uv, index));
|
||||
#define T2M_UNPACK_PAINTMAP(uv,index,sum,splat) float4 paintColor##index = (_T2M_Layer_##index##_MapsUsage.x > 0.5 ? UNITY_SAMPLE_TEX2DARRAY(_T2M_DiffuseMaps2DArray, float3(uv * _T2M_Layer_##index##_uvScaleOffset, paintMapUsageIndex)) : float4(1, 1, 1, 1)); paintMapUsageIndex += _T2M_Layer_##index##_MapsUsage.x > 0.5 ? 1 : 0; sum += paintColor##index * _T2M_Layer_##index##_ColorTint * splat;
|
||||
|
||||
#define T2M_UNPACK_NORMAL_MAP(index,uv,sum,splat) sum += TerrainToMeshNormalStrength(UnpackNormal(UNITY_SAMPLE_TEX2DARRAY(_T2M_NormalMaps2DArray, float3(uv * _T2M_Layer_##index##_uvScaleOffset, normalMapUsageIndex))), _T2M_Layer_##index##_NormalScale) * splat; normalMapUsageIndex += 1;
|
||||
#define T2M_UNPACK_MASK(index,uv,sum,splat) sum += TerrainToMeshRemap(UNITY_SAMPLE_TEX2DARRAY(_T2M_MaskMaps2DArray, float3(uv * _T2M_Layer_##index##_uvScaleOffset, maskMapUsageIndex)), _T2M_Layer_##index##_MaskMapRemapMin, _T2M_Layer_##index##_MaskMapRemapMax) * splat; maskMapUsageIndex += 1;
|
||||
|
||||
#else
|
||||
|
||||
#define T2M_UNPACK_SPLATMAP(uv,index) UNITY_SAMPLE_TEX2D_SAMPLER(_T2M_SplatMap_##index, _T2M_SplatMap_0, uv);
|
||||
#define T2M_UNPACK_PAINTMAP(uv,index,sum,splat) float4 paintColor##index = UNITY_SAMPLE_TEX2D_SAMPLER(_T2M_Layer_##index##_Diffuse, _T2M_Layer_0_Diffuse, uv * _T2M_Layer_##index##_uvScaleOffset); sum += paintColor##index * _T2M_Layer_##index##_ColorTint * splat;
|
||||
|
||||
#define T2M_UNPACK_NORMAL_MAP(index,uv,sum,splat) sum += TerrainToMeshNormalStrength(UnpackNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_T2M_Layer_##index##_NormalMap, _T2M_Layer_0_Diffuse, uv * _T2M_Layer_##index##_uvScaleOffset)), _T2M_Layer_##index##_NormalScale) * splat;
|
||||
#define T2M_UNPACK_MASK(index,uv,sum,splat) sum += TerrainToMeshRemap(UNITY_SAMPLE_TEX2D_SAMPLER(_T2M_Layer_##index##_Mask, _T2M_Layer_0_Diffuse, uv * _T2M_Layer_##index##_uvScaleOffset), _T2M_Layer_##index##_MaskMapRemapMin, _T2M_Layer_##index##_MaskMapRemapMax) * splat;
|
||||
|
||||
#endif
|
||||
|
||||
#define T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(index,sum,splat) sum += float4(_T2M_Layer_##index##_MetallicOcclusionSmoothness.rgb, lerp(_T2M_Layer_##index##_MetallicOcclusionSmoothness.a, paintColor##index.a, _T2M_Layer_##index##_SmoothnessFromDiffuseAlpha)) * splat;
|
||||
|
||||
|
||||
|
||||
|
||||
float TerrainToMeshCalculateClipValue(float2 uv)
|
||||
{
|
||||
#if defined(_ALPHATEST_ON)
|
||||
|
||||
float4 holesmap = UNITY_SAMPLE_TEX2D(_T2M_HolesMap, uv);
|
||||
return holesmap.r;
|
||||
|
||||
#else
|
||||
|
||||
return 1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TerrainToMeshCalculateLayersBlend(float2 uv, out float3 albedoValue, out float alphaValue, out float3 normalValue, out float metallicValue, out float smoothnessValue, out float occlusionValue)
|
||||
{
|
||||
//Splatmaps//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float4 splatmap0 = T2M_UNPACK_SPLATMAP(uv, 0);
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_1)
|
||||
float4 splatmap1 = T2M_UNPACK_SPLATMAP(uv, 1);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_2)
|
||||
float4 splatmap2 = T2M_UNPACK_SPLATMAP(uv, 2);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_3)
|
||||
float4 splatmap3 = T2M_UNPACK_SPLATMAP(uv, 3);
|
||||
#endif
|
||||
|
||||
|
||||
//Paint Textures////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
float4 paintColorSum = 0;
|
||||
|
||||
|
||||
#if defined(_T2M_TEXTURE_SAMPLE_TYPE_ARRAY)
|
||||
int paintMapUsageIndex = 0;
|
||||
#endif
|
||||
|
||||
|
||||
T2M_UNPACK_PAINTMAP(uv, 0, paintColorSum, splatmap0.r);
|
||||
T2M_UNPACK_PAINTMAP(uv, 1, paintColorSum, splatmap0.g);
|
||||
|
||||
#if defined(NEED_PAINT_MAP_2)
|
||||
T2M_UNPACK_PAINTMAP(uv, 2, paintColorSum, splatmap0.b);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_3)
|
||||
T2M_UNPACK_PAINTMAP(uv, 3, paintColorSum, splatmap0.a);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_1)
|
||||
#if defined(NEED_PAINT_MAP_4)
|
||||
T2M_UNPACK_PAINTMAP(uv, 4, paintColorSum, splatmap1.r);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_5)
|
||||
T2M_UNPACK_PAINTMAP(uv, 5, paintColorSum, splatmap1.g);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_6)
|
||||
T2M_UNPACK_PAINTMAP(uv, 6, paintColorSum, splatmap1.b);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_7)
|
||||
T2M_UNPACK_PAINTMAP(uv, 7, paintColorSum, splatmap1.a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_2)
|
||||
#if defined(NEED_PAINT_MAP_8)
|
||||
T2M_UNPACK_PAINTMAP(uv, 8, paintColorSum, splatmap2.r);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_9)
|
||||
T2M_UNPACK_PAINTMAP(uv, 9, paintColorSum, splatmap2.g);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_10)
|
||||
T2M_UNPACK_PAINTMAP(uv, 10, paintColorSum, splatmap2.b);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_11)
|
||||
T2M_UNPACK_PAINTMAP(uv, 11, paintColorSum, splatmap2.a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_3)
|
||||
#if defined(NEED_PAINT_MAP_12)
|
||||
T2M_UNPACK_PAINTMAP(uv, 12, paintColorSum, splatmap3.r);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_13)
|
||||
T2M_UNPACK_PAINTMAP(uv, 13, paintColorSum, splatmap3.g);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_14)
|
||||
T2M_UNPACK_PAINTMAP(uv, 14, paintColorSum, splatmap3.b);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_15)
|
||||
T2M_UNPACK_PAINTMAP(uv, 15, paintColorSum, splatmap3.a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
albedoValue = paintColorSum.rgb;
|
||||
alphaValue = paintColorSum.a;
|
||||
|
||||
|
||||
|
||||
//Normal//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef TERRAIN_TO_MESH_NEED_NORMAL
|
||||
|
||||
float3 emptyNormal = float3(0, 0, 1);
|
||||
normalValue = 0;
|
||||
|
||||
#if defined(_T2M_TEXTURE_SAMPLE_TYPE_ARRAY)
|
||||
int normalMapUsageIndex = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_T2M_LAYER_0_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(0, uv, normalValue, splatmap0.r);
|
||||
#else
|
||||
normalValue += splatmap0.r * emptyNormal;
|
||||
#endif
|
||||
|
||||
#if defined(_T2M_LAYER_1_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(1, uv, normalValue, splatmap0.g);
|
||||
#else
|
||||
normalValue += splatmap0.g * emptyNormal;
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_2
|
||||
#if defined(_T2M_LAYER_2_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(2, uv, normalValue, splatmap0.b);
|
||||
#else
|
||||
normalValue += splatmap0.b * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_3
|
||||
#if defined(_T2M_LAYER_3_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(3, uv, normalValue, splatmap0.a);
|
||||
#else
|
||||
normalValue += splatmap0.a * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_1)
|
||||
#ifdef NEED_PAINT_MAP_4
|
||||
#if defined(_T2M_LAYER_4_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(4, uv, normalValue, splatmap1.r);
|
||||
#else
|
||||
normalValue += splatmap1.r * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_5
|
||||
#if defined(_T2M_LAYER_5_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(5, uv, normalValue, splatmap1.g);
|
||||
#else
|
||||
normalValue += splatmap1.g * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_6
|
||||
#if defined(_T2M_LAYER_6_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(6, uv, normalValue, splatmap1.b);
|
||||
#else
|
||||
normalValue += splatmap1.b * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_7
|
||||
#if defined(_T2M_LAYER_7_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(7, uv, normalValue, splatmap1.a);
|
||||
#else
|
||||
normalValue += splatmap1.a * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_2)
|
||||
#ifdef NEED_PAINT_MAP_8
|
||||
#if defined(_T2M_LAYER_8_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(8, uv, normalValue, splatmap2.r);
|
||||
#else
|
||||
normalValue += splatmap2.r * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_9
|
||||
#if defined(_T2M_LAYER_9_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(9, uv, normalValue, splatmap2.g);
|
||||
#else
|
||||
normalValue += splatmap2.g * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_10
|
||||
#if defined(_T2M_LAYER_10_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(10, uv, normalValue, splatmap2.b);
|
||||
#else
|
||||
normalValue += splatmap2.b * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_11
|
||||
#if defined(_T2M_LAYER_11_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(11, uv, normalValue, splatmap2.a);
|
||||
#else
|
||||
normalValue += splatmap2.a * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_3)
|
||||
#ifdef NEED_PAINT_MAP_12
|
||||
#if defined(_T2M_LAYER_12_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(12, uv, normalValue, splatmap3.r);
|
||||
#else
|
||||
normalValue += splatmap3.r * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_13
|
||||
#if defined(_T2M_LAYER_13_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(13, uv, normalValue, splatmap3.g);
|
||||
#else
|
||||
normalValue += splatmap3.g * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_14
|
||||
#if defined(_T2M_LAYER_14_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(14, uv, normalValue, splatmap3.b);
|
||||
#else
|
||||
normalValue += splatmap3.b * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_15
|
||||
#if defined(_T2M_LAYER_15_NORMAL)
|
||||
T2M_UNPACK_NORMAL_MAP(15, uv, normalValue, splatmap3.a);
|
||||
#else
|
||||
normalValue += splatmap3.a * emptyNormal;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
normalValue = float3(0, 0, 1);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//Metallic, Occlusion, Smoothness////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef TERRAIN_TO_MESH_NEED_METALLIC_SMOOTHNESS_OCCLUSION
|
||||
|
||||
float4 metallicSmoothnessOcclusion = 0;
|
||||
|
||||
#if defined(_T2M_TEXTURE_SAMPLE_TYPE_ARRAY)
|
||||
int maskMapUsageIndex = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_T2M_LAYER_0_MASK)
|
||||
T2M_UNPACK_MASK(0, uv, metallicSmoothnessOcclusion, splatmap0.r);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(0, metallicSmoothnessOcclusion, splatmap0.r);
|
||||
#endif
|
||||
|
||||
#if defined(_T2M_LAYER_1_MASK)
|
||||
T2M_UNPACK_MASK(1, uv, metallicSmoothnessOcclusion, splatmap0.g);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(1, metallicSmoothnessOcclusion, splatmap0.g);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_2)
|
||||
#if defined(_T2M_LAYER_2_MASK)
|
||||
T2M_UNPACK_MASK(2, uv, metallicSmoothnessOcclusion, splatmap0.b);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(2, metallicSmoothnessOcclusion, splatmap0.b);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_3)
|
||||
#if defined(_T2M_LAYER_3_MASK)
|
||||
T2M_UNPACK_MASK(3, uv, metallicSmoothnessOcclusion, splatmap0.a);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(3, metallicSmoothnessOcclusion, splatmap0.a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_1)
|
||||
#if defined(NEED_PAINT_MAP_4)
|
||||
#if defined(_T2M_LAYER_4_MASK)
|
||||
T2M_UNPACK_MASK(4, uv, metallicSmoothnessOcclusion, splatmap1.r);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(4, metallicSmoothnessOcclusion, splatmap1.r);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_5)
|
||||
#if defined(_T2M_LAYER_5_MASK)
|
||||
T2M_UNPACK_MASK(5, uv, metallicSmoothnessOcclusion, splatmap1.g);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(5, metallicSmoothnessOcclusion, splatmap1.g);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_6)
|
||||
#if defined(_T2M_LAYER_6_MASK)
|
||||
T2M_UNPACK_MASK(6, uv, metallicSmoothnessOcclusion, splatmap1.b);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(6, metallicSmoothnessOcclusion, splatmap1.b);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_7)
|
||||
#if defined(_T2M_LAYER_7_MASK)
|
||||
T2M_UNPACK_MASK(7, uv, metallicSmoothnessOcclusion, splatmap1.a);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(7, metallicSmoothnessOcclusion, splatmap1.a);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_2)
|
||||
#if defined(NEED_PAINT_MAP_8)
|
||||
#if defined(_T2M_LAYER_8_MASK)
|
||||
T2M_UNPACK_MASK(8, uv, metallicSmoothnessOcclusion, splatmap2.r);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(8, metallicSmoothnessOcclusion, splatmap2.r);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_9)
|
||||
#if defined(_T2M_LAYER_9_MASK)
|
||||
T2M_UNPACK_MASK(9, uv, metallicSmoothnessOcclusion, splatmap2.g);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(9, metallicSmoothnessOcclusion, splatmap2.g);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_10)
|
||||
#if defined(_T2M_LAYER_10_MASK)
|
||||
T2M_UNPACK_MASK(10, uv, metallicSmoothnessOcclusion, splatmap2.b);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(10, metallicSmoothnessOcclusion, splatmap2.b);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_11)
|
||||
#if defined(_T2M_LAYER_11_MASK)
|
||||
T2M_UNPACK_MASK(11, uv, metallicSmoothnessOcclusion, splatmap2.a);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(11, metallicSmoothnessOcclusion, splatmap2.a);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_3)
|
||||
#if defined(NEED_PAINT_MAP_12)
|
||||
#if defined(_T2M_LAYER_12_MASK)
|
||||
T2M_UNPACK_MASK(12, uv, metallicSmoothnessOcclusion, splatmap3.r);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(12, metallicSmoothnessOcclusion, splatmap3.r);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_13)
|
||||
#if defined(_T2M_LAYER_13_MASK)
|
||||
T2M_UNPACK_MASK(13, uv, metallicSmoothnessOcclusion, splatmap3.g);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(13, metallicSmoothnessOcclusion, splatmap3.g);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_14)
|
||||
#if defined(_T2M_LAYER_14_MASK)
|
||||
T2M_UNPACK_MASK(14, uv, metallicSmoothnessOcclusion, splatmap3.b);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(14, metallicSmoothnessOcclusion, splatmap3.b);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_PAINT_MAP_15)
|
||||
#if defined(_T2M_LAYER_15_MASK)
|
||||
T2M_UNPACK_MASK(15, uv, metallicSmoothnessOcclusion, splatmap3.a);
|
||||
#else
|
||||
T2M_UNPACK_METALLIC_OCCLUSION_SMOOTHNESS(15, metallicSmoothnessOcclusion, splatmap3.a);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
metallicSmoothnessOcclusion = saturate(metallicSmoothnessOcclusion);
|
||||
|
||||
metallicValue = metallicSmoothnessOcclusion.r;
|
||||
smoothnessValue = metallicSmoothnessOcclusion.a;
|
||||
occlusionValue = metallicSmoothnessOcclusion.g;
|
||||
|
||||
#else
|
||||
|
||||
metallicValue = 0;
|
||||
smoothnessValue = 0;
|
||||
occlusionValue = 1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9f4fea2e37009b46a947588e42010de
|
||||
timeCreated: 1446882387
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,416 @@
|
||||
#ifndef TERRAIN_TO_MESH_VARIABLES_CGINC
|
||||
#define TERRAIN_TO_MESH_VARIABLES_CGINC
|
||||
|
||||
|
||||
|
||||
#if defined(_T2M_LAYER_COUNT_3)
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_4)
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_5)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_6)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_7)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_8)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_9)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_10)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_11)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
#define NEED_PAINT_MAP_10
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_12)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
#define NEED_PAINT_MAP_10
|
||||
#define NEED_PAINT_MAP_11
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_13)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
#define NEED_SPLAT_MAP_3
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
#define NEED_PAINT_MAP_10
|
||||
#define NEED_PAINT_MAP_11
|
||||
#define NEED_PAINT_MAP_12
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_14)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
#define NEED_SPLAT_MAP_3
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
#define NEED_PAINT_MAP_10
|
||||
#define NEED_PAINT_MAP_11
|
||||
#define NEED_PAINT_MAP_12
|
||||
#define NEED_PAINT_MAP_13
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_15)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
#define NEED_SPLAT_MAP_3
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
#define NEED_PAINT_MAP_10
|
||||
#define NEED_PAINT_MAP_11
|
||||
#define NEED_PAINT_MAP_12
|
||||
#define NEED_PAINT_MAP_13
|
||||
#define NEED_PAINT_MAP_14
|
||||
|
||||
#elif defined(_T2M_LAYER_COUNT_16)
|
||||
|
||||
#define NEED_SPLAT_MAP_1
|
||||
#define NEED_SPLAT_MAP_2
|
||||
#define NEED_SPLAT_MAP_3
|
||||
|
||||
#define NEED_PAINT_MAP_2
|
||||
#define NEED_PAINT_MAP_3
|
||||
#define NEED_PAINT_MAP_4
|
||||
#define NEED_PAINT_MAP_5
|
||||
#define NEED_PAINT_MAP_6
|
||||
#define NEED_PAINT_MAP_7
|
||||
#define NEED_PAINT_MAP_8
|
||||
#define NEED_PAINT_MAP_9
|
||||
#define NEED_PAINT_MAP_10
|
||||
#define NEED_PAINT_MAP_11
|
||||
#define NEED_PAINT_MAP_12
|
||||
#define NEED_PAINT_MAP_13
|
||||
#define NEED_PAINT_MAP_14
|
||||
#define NEED_PAINT_MAP_15
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_T2M_TEXTURE_SAMPLE_TYPE_ARRAY)
|
||||
|
||||
#define T2M_DECLARE_LAYER(l) float4 _T2M_Layer_##l##_MapsUsage; float2 _T2M_Layer_##l##_uvScaleOffset; float4 _T2M_Layer_##l##_ColorTint; float4 _T2M_Layer_##l##_MetallicOcclusionSmoothness; int _T2M_Layer_##l##_SmoothnessFromDiffuseAlpha;
|
||||
#define T2M_DECALRE_NORMAL(l) float _T2M_Layer_##l##_NormalScale;
|
||||
#define T2M_DECALRE_MASK(l) float4 _T2M_Layer_##l##_MaskMapRemapMin; float4 _T2M_Layer_##l##_MaskMapRemapMax;
|
||||
|
||||
#else
|
||||
|
||||
#define T2M_DECLARE_LAYER(l) UNITY_DECLARE_TEX2D_NOSAMPLER(_T2M_Layer_##l##_Diffuse); float2 _T2M_Layer_##l##_uvScaleOffset; float4 _T2M_Layer_##l##_ColorTint; float4 _T2M_Layer_##l##_MetallicOcclusionSmoothness; int _T2M_Layer_##l##_SmoothnessFromDiffuseAlpha;
|
||||
#define T2M_DECALRE_NORMAL(l) UNITY_DECLARE_TEX2D_NOSAMPLER(_T2M_Layer_##l##_NormalMap); float _T2M_Layer_##l##_NormalScale;
|
||||
#define T2M_DECALRE_MASK(l) UNITY_DECLARE_TEX2D_NOSAMPLER(_T2M_Layer_##l##_Mask); float4 _T2M_Layer_##l##_MaskMapRemapMin; float4 _T2M_Layer_##l##_MaskMapRemapMax;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//Layer Count/////////////////////////////////////////////////////////////////////////////
|
||||
int _T2M_Layer_Count;
|
||||
|
||||
//Holes///////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(_ALPHATEST_ON)
|
||||
UNITY_DECLARE_TEX2D(_T2M_HolesMap);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_T2M_TEXTURE_SAMPLE_TYPE_ARRAY)
|
||||
|
||||
UNITY_DECLARE_TEX2DARRAY(_T2M_SplatMaps2DArray);
|
||||
UNITY_DECLARE_TEX2DARRAY(_T2M_DiffuseMaps2DArray);
|
||||
UNITY_DECLARE_TEX2DARRAY(_T2M_NormalMaps2DArray);
|
||||
UNITY_DECLARE_TEX2DARRAY(_T2M_MaskMaps2DArray);
|
||||
|
||||
float4 _T2M_Layer_0_MapsUsage;
|
||||
|
||||
#else
|
||||
|
||||
//Splatmaps///////////////////////////////////////////////////////////////////////////////
|
||||
UNITY_DECLARE_TEX2D(_T2M_SplatMap_0);
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_1)
|
||||
UNITY_DECLARE_TEX2D_NOSAMPLER(_T2M_SplatMap_1);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_2)
|
||||
UNITY_DECLARE_TEX2D_NOSAMPLER(_T2M_SplatMap_2);
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_3)
|
||||
UNITY_DECLARE_TEX2D_NOSAMPLER(_T2M_SplatMap_3);
|
||||
#endif
|
||||
|
||||
|
||||
//Layers//////////////////////////////////////////////////////////////////////////////////
|
||||
UNITY_DECLARE_TEX2D(_T2M_Layer_0_Diffuse);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
float2 _T2M_Layer_0_uvScaleOffset;
|
||||
float4 _T2M_Layer_0_ColorTint;
|
||||
float4 _T2M_Layer_0_MetallicOcclusionSmoothness;
|
||||
int _T2M_Layer_0_SmoothnessFromDiffuseAlpha;
|
||||
|
||||
#if defined(_T2M_LAYER_0_NORMAL)
|
||||
T2M_DECALRE_NORMAL(0)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_0_MASK)
|
||||
T2M_DECALRE_MASK(0)
|
||||
#endif
|
||||
|
||||
T2M_DECLARE_LAYER(1)
|
||||
#if defined(_T2M_LAYER_1_NORMAL)
|
||||
T2M_DECALRE_NORMAL(1)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_1_MASK)
|
||||
T2M_DECALRE_MASK(1)
|
||||
#endif
|
||||
|
||||
T2M_DECLARE_LAYER(2)
|
||||
#if defined(_T2M_LAYER_2_NORMAL)
|
||||
T2M_DECALRE_NORMAL(2)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_2_MASK)
|
||||
T2M_DECALRE_MASK(2)
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_3
|
||||
T2M_DECLARE_LAYER(3)
|
||||
#if defined(_T2M_LAYER_3_NORMAL)
|
||||
T2M_DECALRE_NORMAL(3)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_3_MASK)
|
||||
T2M_DECALRE_MASK(3)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_1)
|
||||
#ifdef NEED_PAINT_MAP_4
|
||||
T2M_DECLARE_LAYER(4)
|
||||
#if defined(_T2M_LAYER_4_NORMAL)
|
||||
T2M_DECALRE_NORMAL(4)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_4_MASK)
|
||||
T2M_DECALRE_MASK(4)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_5
|
||||
T2M_DECLARE_LAYER(5)
|
||||
#if defined(_T2M_LAYER_5_NORMAL)
|
||||
T2M_DECALRE_NORMAL(5)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_5_MASK)
|
||||
T2M_DECALRE_MASK(5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_6
|
||||
T2M_DECLARE_LAYER(6)
|
||||
#if defined(_T2M_LAYER_6_NORMAL)
|
||||
T2M_DECALRE_NORMAL(6)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_6_MASK)
|
||||
T2M_DECALRE_MASK(6)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_7
|
||||
T2M_DECLARE_LAYER(7)
|
||||
#if defined(_T2M_LAYER_7_NORMAL)
|
||||
T2M_DECALRE_NORMAL(7)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_7_MASK)
|
||||
T2M_DECALRE_MASK(7)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_2)
|
||||
#ifdef NEED_PAINT_MAP_8
|
||||
T2M_DECLARE_LAYER(8)
|
||||
#if defined(_T2M_LAYER_8_NORMAL)
|
||||
T2M_DECALRE_NORMAL(8)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_8_MASK)
|
||||
T2M_DECALRE_MASK(8)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_9
|
||||
T2M_DECLARE_LAYER(9)
|
||||
#if defined(_T2M_LAYER_9_NORMAL)
|
||||
T2M_DECALRE_NORMAL(9)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_9_MASK)
|
||||
T2M_DECALRE_MASK(9)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_10
|
||||
T2M_DECLARE_LAYER(10)
|
||||
#if defined(_T2M_LAYER_10_NORMAL)
|
||||
T2M_DECALRE_NORMAL(10)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_10_MASK)
|
||||
T2M_DECALRE_MASK(10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_11
|
||||
T2M_DECLARE_LAYER(11)
|
||||
#if defined(_T2M_LAYER_11_NORMAL)
|
||||
T2M_DECALRE_NORMAL(11)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_11_MASK)
|
||||
T2M_DECALRE_MASK(11)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NEED_SPLAT_MAP_3)
|
||||
#ifdef NEED_PAINT_MAP_12
|
||||
T2M_DECLARE_LAYER(12)
|
||||
#if defined(_T2M_LAYER_12_NORMAL)
|
||||
T2M_DECALRE_NORMAL(12)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_12_MASK)
|
||||
T2M_DECALRE_MASK(12)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_13
|
||||
T2M_DECLARE_LAYER(13)
|
||||
#if defined(_T2M_LAYER_13_NORMAL)
|
||||
T2M_DECALRE_NORMAL(13)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_13_MASK)
|
||||
T2M_DECALRE_MASK(13)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_14
|
||||
T2M_DECLARE_LAYER(14)
|
||||
#if defined(_T2M_LAYER_14_NORMAL)
|
||||
T2M_DECALRE_NORMAL(14)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_14_MASK)
|
||||
T2M_DECALRE_MASK(14)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PAINT_MAP_15
|
||||
T2M_DECLARE_LAYER(15)
|
||||
#if defined(_T2M_LAYER_15_NORMAL)
|
||||
T2M_DECALRE_NORMAL(15)
|
||||
#endif
|
||||
#if defined(_T2M_LAYER_15_MASK)
|
||||
T2M_DECALRE_MASK(15)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 780f5951c0209764187c8aa048841bae
|
||||
timeCreated: 1446882387
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user