diff --git a/Assets/GFX/Shaders/Backup/FaTerrainShader 1.shader b/Assets/GFX/Shaders/Backup/FaTerrainShader 1.shader deleted file mode 100644 index 9a4f773b..00000000 --- a/Assets/GFX/Shaders/Backup/FaTerrainShader 1.shader +++ /dev/null @@ -1,426 +0,0 @@ -// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' - -Shader "MapEditor/FaTerrainShader" { -Properties { - _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1) - _Shininess ("Shininess", Range (0.03, 1)) = 0.078125 - [MaterialToggle] _Water("Has Water", Int) = 0 - [MaterialToggle] _Grid("Grid", Int) = 0 - [MaterialToggle] _Slope("Slope", Int) = 0 - [MaterialToggle] _UseSlopeTex("Use Slope Data", Int) = 0 - _SlopeTex ("Slope data", 2D) = "black" {} - [MaterialToggle] _TTerrainXP("_TTerrainXP", Int) = 0 - - _WaterLevel ("Water Level", float) = 0.078125 - _DepthLevel ("Depth Level", float) = 0.078125 - _AbyssLevel ("Abyss Level", float) = 0.078125 - - // set by terrain engine - _Control ("Control (RGBA)", 2D) = "black" {} - _ControlXP ("ControlXP (RGBA)", 2D) = "black" {} - _Control2XP ("Control2XP (RGBA)", 2D) = "black" {} - - - [MaterialToggle] _HideSplat0("Hide splat 2", Int) = 0 - [MaterialToggle] _HideSplat1("Hide splat 2", Int) = 0 - [MaterialToggle] _HideSplat2("Hide splat 3", Int) = 0 - [MaterialToggle] _HideSplat3("Hide splat 4", Int) = 0 - [MaterialToggle] _HideSplat4("Hide splat 5", Int) = 0 - [MaterialToggle] _HideSplat5("Hide splat 6", Int) = 0 - [MaterialToggle] _HideSplat6("Hide splat 7", Int) = 0 - [MaterialToggle] _HideSplat7("Hide splat 8", Int) = 0 - [MaterialToggle] _HideSplat8("Hide splat Upper", Int) = 0 - - _SplatAlbedoArray ("Albedo array", 2DArray) = "" {} - _SplatNormalArray ("Normal array", 2DArray) = "" {} - - - _Splat0Scale ("Splat1 Level", Range (1, 1024)) = 10 - _Splat1Scale ("Splat2 Level", Range (1, 1024)) = 10 - _Splat2Scale ("Splat3 Level", Range (1, 1024)) = 10 - _Splat3Scale ("Splat4 Level", Range (1, 1024)) = 10 - _Splat4Scale ("Splat5 Level", Range (1, 1024)) = 10 - _Splat5Scale ("Splat6 Level", Range (1, 1024)) = 10 - _Splat6Scale ("Splat7 Level", Range (1, 1024)) = 10 - _Splat7Scale ("Splat8 Level", Range (1, 1024)) = 10 - - // set by terrain engine - [MaterialToggle] _GeneratingNormal("Generating Normal", Int) = 0 - _TerrainNormal ("Terrain Normal", 2D) = "bump" {} - - - _Splat0ScaleNormal ("Splat1 Normal Level", Range (1, 1024)) = 10 - _Splat1ScaleNormal ("Splat2 Normal Level", Range (1, 1024)) = 10 - _Splat2ScaleNormal ("Splat3 Normal Level", Range (1, 1024)) = 10 - _Splat3ScaleNormal ("Splat4 Normal Level", Range (1, 1024)) = 10 - _Splat4ScaleNormal ("Splat5 Normal Level", Range (1, 1024)) = 10 - _Splat5ScaleNormal ("Splat6 Normal Level", Range (1, 1024)) = 10 - _Splat6ScaleNormal ("Splat7 Normal Level", Range (1, 1024)) = 10 - _Splat7ScaleNormal ("Splat8 Normal Level", Range (1, 1024)) = 10 - - // used in fallback on old cards & base map - [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {} - [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1) - - [MaterialToggle] _Brush ("Brush", Int) = 0 - _BrushTex ("Brush (RGB)", 2D) = "white" {} - _BrushSize ("Brush Size", Range (0, 128)) = 0 - _BrushUvX ("Brush X", Range (0, 1)) = 0 - _BrushUvY ("Brush Y", Range (0, 1)) = 0 - - //Lower Stratum - _SplatLower ("Layer Lower (R)", 2D) = "white" {} - _NormalLower ("Normal Lower (R)", 2D) = "bump" {} - _LowerScale ("Lower Level", Range (1, 128)) = 1 - _LowerScaleNormal ("Lower Normal Level", Range (1, 128)) = 1 - - //Upper Stratum - _SplatUpper ("Layer Lower (R)", 2D) = "white" {} - _NormalUpper ("Normal Lower (R)", 2D) = "bump" {} - _UpperScale ("Upper Level", Range (1, 128)) = 1 - _UpperScaleNormal ("Upper Normal Level", Range (1, 128)) = 1 - - _GridScale ("Grid Scale", Range (0, 2048)) = 512 - _GridTexture ("Grid Texture", 2D) = "white" {} - //_GridCamDist ("Grid Scale", Range (0, 10)) = 5 - //_WaterScaleX ("Water Scale X", float) = 1024 - //_WaterScaleZ ("Water Scale Z", float) = 1024 -} - - SubShader { - - CGPROGRAM - #define UNITY_BRDF_PBS BRDF3_Unity_PBS - - #pragma surface surf SimpleLambert vertex:vert fullforwardshadows addshadow nometa - //#pragma debug - #pragma target 3.5 - #pragma exclude_renderers gles - #include "UnityLightingCommon.cginc" - #include "UnityGBuffer.cginc" - #include "UnityGlobalIllumination.cginc" - #include "Assets/GFX/Shaders/SimpleLambert.cginc" - - struct Input { - float2 uv_Control : TEXCOORD0; - float3 worldPos; - float SlopeLerp; - float4 grabUV; - }; - - half _GeneratingNormal; - - void vert (inout appdata_full v, out Input o){ - UNITY_INITIALIZE_OUTPUT(Input,o); - - o.SlopeLerp = dot(v.normal, half3(0,1,0)); - - if(_GeneratingNormal == 0) - v.normal = float3(0,1,0); - v.tangent.xyz = cross(v.normal, float3(0,0,1)); - v.tangent.w = -1; - //o.normal = v.normal; - float4 hpos = UnityObjectToClipPos (v.vertex); - o.grabUV = ComputeGrabScreenPos(hpos); - //v.color = _Abyss; - } - - sampler2D _MyGrabTexture3; - sampler2D _WaterRam; - half _Shininess; - half _WaterLevel; - half _DepthLevel, _AbyssLevel; - fixed4 _Abyss; - fixed4 _Deep; - int _Water; - - int _Slope, _UseSlopeTex; - sampler2D _SlopeTex; - - int _Grid; - half _GridScale; - half _GridCamDist; - sampler2D _GridTexture; - - //uniform - sampler2D _ControlXP; - sampler2D _Control2XP; - uniform sampler2D _UtilitySamplerC; - sampler2D _TerrainNormal; - sampler2D _SplatLower, _SplatUpper; - sampler2D _NormalLower; - //sampler2D _SplatNormal0, _SplatNormal1, _SplatNormal2, _SplatNormal3, _SplatNormal4, _SplatNormal5, _SplatNormal6, _SplatNormal7; - half _Splat0Scale, _Splat1Scale, _Splat2Scale, _Splat3Scale, _Splat4Scale, _Splat5Scale, _Splat6Scale, _Splat7Scale; - half _Splat0ScaleNormal, _Splat1ScaleNormal, _Splat2ScaleNormal, _Splat3ScaleNormal, _Splat4ScaleNormal, _Splat5ScaleNormal, _Splat6ScaleNormal, _Splat7ScaleNormal; - - UNITY_DECLARE_TEX2DARRAY(_SplatAlbedoArray); - UNITY_DECLARE_TEX2DARRAY(_SplatNormalArray); - - int _HideSplat0, _HideSplat1, _HideSplat2, _HideSplat3, _HideSplat4, _HideSplat5, _HideSplat6, _HideSplat7, _HideSplat8; - - half _LowerScale, _UpperScale; - fixed _TTerrainXP; - uniform float _WaterScaleX, _WaterScaleZ; - - int _Brush; - sampler2D _BrushTex; - half _BrushSize; - half _BrushUvX; - half _BrushUvY; - - uniform int _Area; - uniform half4 _AreaRect; - - - - float3 ApplyWaterColor( float depth, float3 inColor){ - float4 wcolor = tex2D(_WaterRam, float2(depth,0)); - return lerp( inColor.rgb, wcolor.rgb, wcolor.a ); - //return inColor.rgb; - //return inColor; - } - - inline fixed3 UnpackNormalDXT5nmScaled (fixed4 packednormal, fixed scale) -{ - fixed3 normal = 0; - normal.xz = packednormal.wx * 2 - 1; - - - - normal.y = sqrt(1 - saturate(dot(normal.xz, normal.xz))); - - normal.xz *= scale; - - - return normal.xzy; - } - - void surf (Input IN, inout SurfaceOutput o) { - - float4 waterTexture = tex2D( _UtilitySamplerC, IN.uv_Control * float2(1, -1) + float2(1 / (_WaterScaleX * 1), 1 / (_WaterScaleZ * 1) + 1)); - - //float WaterDepth = (_WaterLevel - IN.worldPos.y) / (_WaterLevel - _AbyssLevel); - float WaterDepth = waterTexture.g; - - float2 UVCtrl = IN.uv_Control * fixed2(1, -1) + half2(0, 1); - float2 UV = IN.uv_Control * fixed2(1, -1) + half2(0, 1); - //float2 UV = IN.uv_Control * half2(1, -1) + half2(0, 1); - float4 splat_control = saturate(tex2D (_ControlXP, UVCtrl) * 2 - 1); - float4 splat_control2 = saturate(tex2D (_Control2XP, UVCtrl) * 2 - 1); - - //float4 col = tex2Dproj( _MyGrabTexture3, UNITY_PROJ_COORD(IN.grabUV)); - - - - float4 col = tex2D(_SplatLower, UV * _LowerScale); - - if(_HideSplat0 == 0) - //col = lerp(col, tex2D(_Splat0XP, UV * _Splat0Scale), splat_control.r); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat0Scale, 0)), splat_control.r); - if(_HideSplat1 == 0) - //col = lerp(col, tex2D(_Splat1XP, UV * _Splat1Scale), splat_control.g); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat1Scale, 1)), splat_control.g); - if(_HideSplat2 == 0) - //col = lerp(col, tex2D(_Splat2XP, UV * _Splat2Scale), splat_control.b); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat2Scale, 2)), splat_control.b); - if(_HideSplat3 == 0) - //col = lerp(col, tex2D(_Splat3XP, UV * _Splat3Scale), splat_control.a); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat3Scale, 3)), splat_control.a); - - if (_TTerrainXP > 0) { - if(_HideSplat4 == 0) - //col = lerp(col, tex2D(_Splat4XP, UV * _Splat4Scale), splat_control2.r); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat4Scale, 4)), splat_control2.r); - if(_HideSplat5 == 0) - //col = lerp(col, tex2D(_Splat5XP, UV * _Splat5Scale), splat_control2.g); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat5Scale, 5)), splat_control2.g); - if(_HideSplat6 == 0) - //col = lerp(col, tex2D(_Splat6XP, UV * _Splat6Scale), splat_control2.b); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat6Scale, 6)), splat_control2.b); - if(_HideSplat7 == 0) - //col = lerp(col, tex2D(_Splat7XP, UV * _Splat7Scale), splat_control2.a); - col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat7Scale, 7)), splat_control2.a); - } - - if(_HideSplat8 == 0){ - float4 UpperAlbedo = tex2D (_SplatUpper, UV * _UpperScale); - col = lerp(col, UpperAlbedo, UpperAlbedo.a); - } - - - - - - - //col = 1; - half4 nrm; - //UV *= 0.01; - nrm = tex2D (_NormalLower, UV * _LowerScale); - if(_HideSplat0 == 0) - //nrm = lerp(nrm, tex2D (_SplatNormal0, UV * _Splat0ScaleNormal), splat_control.r); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat0ScaleNormal, 0)), splat_control.r); - if(_HideSplat1 == 0) - //nrm = lerp(nrm, tex2D (_SplatNormal1, UV * _Splat1ScaleNormal), splat_control.g); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat1ScaleNormal, 1)), splat_control.g); - if(_HideSplat2 == 0) - //nrm = lerp(nrm, tex2D (_SplatNormal2, UV * _Splat2ScaleNormal), splat_control.b); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat2ScaleNormal, 2)), splat_control.b); - if(_HideSplat3 == 0) - //nrm = lerp(nrm, tex2D (_SplatNormal3, UV * _Splat3ScaleNormal), splat_control.a); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat3ScaleNormal, 3)), splat_control.a); - - if (_TTerrainXP > 0) { - if(_HideSplat4 == 0) - //nrm = lerp(nrm, tex2D(_SplatNormal4, UV * _Splat4ScaleNormal), splat_control2.r); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat4ScaleNormal, 4)), splat_control2.r); - if(_HideSplat5 == 0) - //nrm = lerp(nrm, tex2D(_SplatNormal5, UV * _Splat5ScaleNormal), splat_control2.g); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat5ScaleNormal, 5)), splat_control2.g); - if(_HideSplat6 == 0) - //nrm = lerp(nrm, tex2D(_SplatNormal6, UV * _Splat6ScaleNormal), splat_control2.b); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat6ScaleNormal, 6)), splat_control2.b); - if(_HideSplat7 == 0) - //nrm = lerp(nrm, tex2D(_SplatNormal7, UV * _Splat7ScaleNormal), splat_control2.a); - nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat7ScaleNormal, 7)), splat_control2.a); - } - - - - //nrm = tex2D (_NormalLower, UV * 1000); - //nrm.rg *= 5; - //nrm.b = 1; - //nrm.rgb = UnpackNormal(nrm); - //nrm.rgb = nrm.rgb * 2 - half3(1, 1, 1); - //nrm.rg *= 3; - //nrm.rgb = normalize(nrm.rgb); - //o.Normal = UnpackNormalDXT5nm(tex2D(_TerrainNormal, UV )); - //o.Normal = (UnpackNormalDXT5nm(tex2D(_TerrainNormal, UV )) + UnpackNormalDXT5nmScaled(nrm.rgbg, 2)); - if(_GeneratingNormal == 0){ - half4 TerrainNormal = tex2D(_TerrainNormal, UVCtrl ); - half3 TerrainNormalVector = UnpackNormalDXT5nm( half4(TerrainNormal.r, 1 - TerrainNormal.g, TerrainNormal.b, TerrainNormal.a)); - IN.SlopeLerp = dot(TerrainNormalVector, half3(0,0,1)); - //o.Albedo = IN.SlopeLerp; - o.Normal = BlendNormals(TerrainNormalVector , UnpackNormalDXT5nmScaled(nrm.rgbg, 1)); - - } - else - o.Normal = UnpackNormalDXT5nmScaled(nrm.rgbg, 1); - - - // o.Normal.y *= 0.5f; - //o.Normal = normalize(o.Normal); - - //half3 Emit = _SunAmbience.rgb * 2; - half3 Emit = 0; - - if(_Slope > 0){ - o.Normal = half3(0,0,1); - half3 SlopeColor = 0; - if(_UseSlopeTex > 0){ - //col = 0; - float2 UV2 = IN.uv_Control * fixed2(1, 1) + half2(0, 0) - float2(-0.00, -0.00) / _GridScale; - float4 splat_control = tex2D (_SlopeTex, UV2); - SlopeColor = splat_control.rgb; - - } - else{ - - if(IN.worldPos.y < _WaterLevel){ - if(IN.SlopeLerp > 0.75) SlopeColor = half3(0,0.4,1); - else SlopeColor = half3(0.6,0,1); - } - else if(IN.SlopeLerp > 0.999) SlopeColor = half3(0,0.8,0); - else if(IN.SlopeLerp > 0.95) SlopeColor = half3(0.3,0.89,0); - else if(IN.SlopeLerp > 0.80) SlopeColor = half3(0.5,0.8,0); - else SlopeColor = half3(1,0,0); - - } - Emit = SlopeColor * 0.5; - col.rgb = lerp(col.rgb, SlopeColor, 0.5); - } - else if(_Water > 0) col.rgb = ApplyWaterColor(WaterDepth, col.rgb); - - - if(_Grid > 0){ - fixed4 GridColor = tex2D (_GridTexture, IN.uv_Control * _GridScale - float2(-0.00, -0.00)); - fixed4 GridFinal = fixed4(0,0,0,GridColor.a); - if(_GridCamDist < 1){ - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(1,1,1), GridColor.r * lerp(1, 0, _GridCamDist)); - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.g * lerp(1, 0, _GridCamDist)); - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b * lerp(0, 1, _GridCamDist)); - } - else{ - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b); - } - - //col.rgb = lerp(col.rgb, GridFinal.rgb, GridColor.a); - Emit += GridFinal * GridColor.a; - } - - if(_Brush > 0){ - fixed4 BrushColor = tex2D (_BrushTex, ((IN.uv_Control - float2(_BrushUvX, _BrushUvY)) * _GridScale) / (_BrushSize * _GridScale * 0.002) ); - - half LerpValue = clamp(_BrushSize / 20, 0, 1); - - half From = 0.1f; - half To = lerp(0.2f, 0.13f, LerpValue); - half Range = lerp(0.015f, 0.008f, LerpValue); - - if(BrushColor.r >= From && BrushColor.r <= To){ - half AA = 1; - - if (BrushColor.r < From + Range) - AA = (BrushColor.r - From) / Range; - else if(BrushColor.r > To - Range) - AA = 1 - (BrushColor.r - (To - Range)) / Range; - - AA = clamp(AA, 0, 1); - - Emit += half3(0, 0.3, 1) * (AA * 0.8); - } - - Emit += half3(0, BrushColor.r * 0.1, BrushColor.r * 0.2); - } - - - - o.Albedo = col; - o.Emission = Emit; - - if(_Area > 0){ - fixed3 BlackEmit = -1; - fixed3 Albedo = 0; - if(IN.worldPos.x < _AreaRect.x){ - o.Emission = BlackEmit; - o.Albedo = Albedo; - } - else if(IN.worldPos.x > _AreaRect.z){ - o.Emission = BlackEmit; - o.Albedo = Albedo; - } - else if(IN.worldPos.z < _AreaRect.y - _GridScale){ - o.Emission = BlackEmit; - o.Albedo = Albedo; - } - else if(IN.worldPos.z > _AreaRect.w - _GridScale){ - o.Emission = BlackEmit; - o.Albedo = Albedo; - } - } - - //o.Albedo = 0.5; - //o.Emission = tex2D (_SplatNormal3, UV * 10 ); - //o.Emission = nrm; - - o.Gloss = 0; - o.Specular = 0; - o.Alpha = 1; - } - ENDCG - - -} - - -FallBack "Diffuse" -} diff --git a/Assets/GFX/Shaders/Backup/FaTerrainShader 1.shader.meta b/Assets/GFX/Shaders/Backup/FaTerrainShader 1.shader.meta deleted file mode 100644 index 3846367c..00000000 --- a/Assets/GFX/Shaders/Backup/FaTerrainShader 1.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 07332981e20e66d40a9ee102d13a9be8 -timeCreated: 1505636252 -licenseType: Free -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GFX/Shaders/Backup/FaTerrainShaderOld.shader b/Assets/GFX/Shaders/Backup/FaTerrainShaderOld.shader new file mode 100644 index 00000000..6c26de4e --- /dev/null +++ b/Assets/GFX/Shaders/Backup/FaTerrainShaderOld.shader @@ -0,0 +1,465 @@ +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + +Shader "MapEditor/FaTerrainShader" { +Properties { + _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1) + _Shininess ("Shininess", Range (0.03, 1)) = 0.078125 + [MaterialToggle] _Water("Has Water", Int) = 0 + [MaterialToggle] _Grid("Grid", Int) = 0 + [MaterialToggle] _Slope("Slope", Int) = 0 + + _LightingMultiplier ("LightingMultiplier ", Range (0, 10)) = 1 + _SunColor ("Sun Color", Color) = (0.5, 0.5, 0.5, 1) + _SunAmbience ("Ambience Color", Color) = (0.5, 0.5, 0.5, 1) + _ShadowColor ("Shadow Color", Color) = (0.5, 0.5, 0.5, 1) + + + _WaterRam ("Control (RGBA)", 2D) = "blue" {} + _WaterLevel ("Water Level", Range (0.03, 5)) = 0.078125 + _AbyssLevel ("Abyss Level", Range (0.03, 5)) = 0.078125 + + [MaterialToggle] _Area("Area", Int) = 0 + _AreaX ("Area X", Range (0, 2048)) = 0 + _AreaY ("Area Y", Range (0, 2048)) = 0 + _AreaWidht ("Area Widht", Range (0, 2048)) = 0 + _AreaHeight ("Area Height", Range (0, 2048)) = 0 + + // set by terrain engine + _Control ("Control (RGBA)", 2D) = "black" {} + _ControlXP ("ControlXP (RGBA)", 2D) = "black" {} + _Control2XP ("Control2XP (RGBA)", 2D) = "black" {} + + _Splat0XP ("Layer 1 (R)", 2D) = "black" {} + _Splat1XP ("Layer 2 (G)", 2D) = "black" {} + _Splat2XP ("Layer 3 (B)", 2D) = "black" {} + _Splat3XP ("Layer 4 (A)", 2D) = "black" {} + _Splat4XP ("Layer 5 (R)", 2D) = "black" {} + _Splat5XP ("Layer 6 (G)", 2D) = "black" {} + _Splat6XP ("Layer 7 (B)", 2D) = "black" {} + _Splat7XP ("Layer 8 (A)", 2D) = "black" {} + + _Splat0Scale ("Splat1 Level", Range (1, 1024)) = 10 + _Splat1Scale ("Splat2 Level", Range (1, 1024)) = 10 + _Splat2Scale ("Splat3 Level", Range (1, 1024)) = 10 + _Splat3Scale ("Splat4 Level", Range (1, 1024)) = 10 + _Splat4Scale ("Splat5 Level", Range (1, 1024)) = 10 + _Splat5Scale ("Splat6 Level", Range (1, 1024)) = 10 + _Splat6Scale ("Splat7 Level", Range (1, 1024)) = 10 + _Splat7Scale ("Splat8 Level", Range (1, 1024)) = 10 + + // set by terrain engine + _SplatNormal0 ("Normal 1 (A)", 2D) = "bump" {} + _SplatNormal1 ("Normal 2 (B)", 2D) = "bump" {} + _SplatNormal2 ("Normal 3 (G)", 2D) = "bump" {} + _SplatNormal3 ("Normal 4 (R)", 2D) = "bump" {} + _SplatNormal4 ("Normal 5 (A)", 2D) = "bump" {} + _SplatNormal5 ("Normal 6 (B)", 2D) = "bump" {} + _SplatNormal6 ("Normal 7 (G)", 2D) = "bump" {} + _SplatNormal7 ("Normal 8 (R)", 2D) = "bump" {} + + _Splat0ScaleNormal ("Splat1 Normal Level", Range (1, 1024)) = 10 + _Splat1ScaleNormal ("Splat2 Normal Level", Range (1, 1024)) = 10 + _Splat2ScaleNormal ("Splat3 Normal Level", Range (1, 1024)) = 10 + _Splat3ScaleNormal ("Splat4 Normal Level", Range (1, 1024)) = 10 + _Splat4ScaleNormal ("Splat5 Normal Level", Range (1, 1024)) = 10 + _Splat5ScaleNormal ("Splat6 Normal Level", Range (1, 1024)) = 10 + _Splat6ScaleNormal ("Splat7 Normal Level", Range (1, 1024)) = 10 + _Splat7ScaleNormal ("Splat8 Normal Level", Range (1, 1024)) = 10 + + // used in fallback on old cards & base map + [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {} + [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1) + + [MaterialToggle] _Brush ("Brush", Int) = 0 + _BrushTex ("Brush (RGB)", 2D) = "white" {} + _BrushSize ("Brush Size", Range (0, 128)) = 0 + _BrushUvX ("Brush X", Range (0, 1)) = 0 + _BrushUvY ("Brush Y", Range (0, 1)) = 0 + + //Lower Stratum + _SplatLower ("Layer Lower (R)", 2D) = "white" {} + _NormalLower ("Normal Lower (R)", 2D) = "bump" {} + _LowerScale ("Lower Level", Range (1, 128)) = 1 + _LowerScaleNormal ("Lower Normal Level", Range (1, 128)) = 1 + + //Upper Stratum + _SplatUpper ("Layer Lower (R)", 2D) = "white" {} + _NormalUpper ("Normal Lower (R)", 2D) = "bump" {} + _UpperScale ("Upper Level", Range (1, 128)) = 1 + _UpperScaleNormal ("Upper Normal Level", Range (1, 128)) = 1 + + _GridScale ("Grid Scale", Range (0, 2048)) = 512 + _GridTexture ("Grid Texture", 2D) = "white" {} + _GridCamDist ("Grid Scale", Range (0, 10)) = 5 +} + + SubShader { + + Tags { "Queue"="Geometry" } + + CGPROGRAM + #pragma surface surf SimpleLambert vertex:vert noambient fullforwardshadows addshadow nometa + //#pragma debug + #pragma target 4.0 + #pragma exclude_renderers gles + + struct Input { + float2 uv_Control : TEXCOORD0; + float3 worldPos; + float SlopeLerp; + float4 grabUV; + }; + + void vert (inout appdata_full v, out Input o){ + UNITY_INITIALIZE_OUTPUT(Input,o); + v.tangent.xyz = cross(v.normal, float3(0,0,1)); + v.tangent.w = -1; + //o.normal = v.normal; + o.SlopeLerp = dot(v.normal, half3(0,1,0)); + float4 hpos = UnityObjectToClipPos (v.vertex); + o.grabUV = ComputeGrabScreenPos(hpos); + //v.color = _Abyss; + } + + sampler2D _MyGrabTexture3; + sampler2D _WaterRam; + half _Shininess; + half _WaterLevel; + half _AbyssLevel; + fixed4 _Abyss; + fixed4 _Deep; + int _Water; + + int _Slope; + + half _LightingMultiplier; + fixed4 _SunColor; + fixed4 _SunAmbience; + fixed4 _ShadowColor; + + sampler2D _ControlXP; + //sampler2D _Control2XP; + sampler2D _Splat0XP, _Splat1XP, _Splat2XP, _Splat3XP, _SplatLower; + half _LowerScale; + half _Splat0Scale, _Splat1Scale, _Splat2Scale, _Splat3Scale; + + sampler2D _SplatNormal0, _SplatNormal1, _SplatNormal2, _SplatNormal3, _NormalLower; + half _Splat0ScaleNormal, _Splat1ScaleNormal, _Splat2ScaleNormal, _Splat3ScaleNormal; + + float4 LightingSimpleLambert (SurfaceOutput s, float3 lightDir, half atten) { + float NdotL = dot (lightDir, s.Normal); + + float4 c; + float3 spec = float3(0,0,0); + + float3 light = _SunColor.rgb * 2 * saturate(NdotL) * atten + _SunAmbience.rgb * 2; + light = _LightingMultiplier * light + _ShadowColor.rgb * 2 * (1 - light); + + + c.rgb = (s.Albedo + spec) * light; + c.a = s.Alpha; + return c; + } + + float3 ApplyWaterColor( float depth, float3 inColor){ + float4 wcolor = tex2D(_WaterRam, float2(depth,0)); + return lerp( inColor.rgb, wcolor.rgb, wcolor.a ); + } + + void surf (Input IN, inout SurfaceOutput o) { + float WaterDepth = (_WaterLevel - IN.worldPos.y) / (_WaterLevel - _AbyssLevel); + float2 UV = IN.uv_Control * fixed2(1, -1); + float4 splat_control = saturate(tex2D (_ControlXP, UV) * 2 - 1); + //float4 splat_control2 = saturate(tex2D (_Control2XP, UV) * 2 - 1); + + half4 nrm; + nrm = tex2D (_NormalLower, UV * _LowerScale); + nrm = lerp(nrm, tex2D (_SplatNormal0, UV * _Splat0ScaleNormal), splat_control.r); + nrm = lerp(nrm, tex2D (_SplatNormal1, UV * _Splat1ScaleNormal), splat_control.g); + nrm = lerp(nrm, tex2D (_SplatNormal2, UV * _Splat2ScaleNormal), splat_control.b); + nrm = lerp(nrm, tex2D (_SplatNormal3, UV * _Splat3ScaleNormal), splat_control.a); + + + nrm.b = 1; + nrm.rgb = nrm.rgb * 2 - half3(1, 1, 1); + nrm.rgb = normalize(nrm.rgb); + + float4 col = tex2D (_SplatLower, UV * _LowerScale); + col = lerp(col, tex2D (_Splat0XP, UV * _Splat0Scale), splat_control.r); + col = lerp(col, tex2D (_Splat1XP, UV * _Splat1Scale), splat_control.g); + col = lerp(col, tex2D (_Splat2XP, UV * _Splat2Scale), splat_control.b); + col = lerp(col, tex2D (_Splat3XP, UV * _Splat3Scale), splat_control.a); + + + if(_Slope > 0){ + if(IN.worldPos.y < _WaterLevel){ + if(IN.SlopeLerp > 0.75) col.rgb = half3(0,0.4,1); + else col.rgb = half3(0.6,0,1); + } + else if(IN.SlopeLerp > 0.99) col.rgb = half3(0,0.8,0); + else if(IN.SlopeLerp > 0.85) col.rgb = half3(0.5,1,0); + else col.rgb = half3(1,0,0); + o.Albedo = col; + } + else if(_Water > 0) o.Albedo = ApplyWaterColor(WaterDepth, col.rgb); + else o.Albedo = col; + + + o.Gloss = 0; + o.Specular = 0; + o.Alpha = 1; + //o.Alpha = splat_control.r + splat_control.g + splat_control.b + splat_control.a; + } + ENDCG + + + + //******************** 2 + + Blend One OneMinusSrcAlpha + CGPROGRAM + #pragma surface surf SimpleLambert vertex:vert alpha noambient fullforwardshadows addshadow nometa + //#pragma debug + #pragma target 4.0 + #pragma exclude_renderers gles + + struct Input { + float2 uv_Control : TEXCOORD0; + float3 worldPos; + float SlopeLerp; + float4 grabUV; + }; + + void vert (inout appdata_full v, out Input o){ + UNITY_INITIALIZE_OUTPUT(Input,o); + v.tangent.xyz = cross(v.normal, float3(0,0,1)); + v.tangent.w = -1; + //o.normal = v.normal; + o.SlopeLerp = dot(v.normal, half3(0,1,0)); + float4 hpos = UnityObjectToClipPos (v.vertex); + o.grabUV = ComputeGrabScreenPos(hpos); + //v.color = _Abyss; + } + + sampler2D _MyGrabTexture3; + sampler2D _WaterRam; + half _Shininess; + half _WaterLevel; + half _AbyssLevel; + fixed4 _Abyss; + fixed4 _Deep; + int _Water; + + int _Slope; + + + half _LightingMultiplier; + fixed4 _SunColor; + fixed4 _SunAmbience; + fixed4 _ShadowColor; + + //sampler2D _ControlXP; + sampler2D _Control2XP; + sampler2D _Splat4XP, _Splat5XP, _Splat6XP, _Splat7XP, _SplatLower, _SplatUpper; + half _LowerScale, _UpperScale; + half _Splat0Scale, _Splat1Scale, _Splat2Scale, _Splat3Scale, _Splat4Scale, _Splat5Scale, _Splat6Scale, _Splat7Scale; + + sampler2D _SplatNormal0, _SplatNormal1, _SplatNormal2, _SplatNormal3, _NormalLower; + sampler2D _SplatNormal4, _SplatNormal5, _SplatNormal6, _SplatNormal7; + half _Splat0ScaleNormal, _Splat1ScaleNormal, _Splat2ScaleNormal, _Splat3ScaleNormal, _Splat4ScaleNormal, _Splat5ScaleNormal, _Splat6ScaleNormal, _Splat7ScaleNormal; + + float4 LightingSimpleLambert (SurfaceOutput s, float3 lightDir, half atten) { + float NdotL = dot (lightDir, s.Normal); + + float4 c; + float3 spec = float3(0,0,0); + + float3 light = _SunColor.rgb * 2 * saturate(NdotL) * atten + _SunAmbience.rgb * 2; + light = _LightingMultiplier * light + _ShadowColor.rgb * 2 * (1 - light); + + + c.rgb = (s.Albedo + spec) * light; + c.a = s.Alpha; + return c; + } + + float3 ApplyWaterColor( float depth, float3 inColor){ + float4 wcolor = tex2D(_WaterRam, float2(depth,0)); + return lerp( inColor.rgb, wcolor.rgb, wcolor.a ); + } + + void surf (Input IN, inout SurfaceOutput o) { + float WaterDepth = (_WaterLevel - IN.worldPos.y) / (_WaterLevel - _AbyssLevel); + float2 UV = IN.uv_Control * fixed2(1, -1); + //float4 splat_control = saturate(tex2D (_ControlXP, UV) * 2 - 1); + float4 splat_control2 = saturate(tex2D (_Control2XP, UV) * 2 - 1); + + half4 nrm; + nrm = tex2D (_NormalLower, UV * _LowerScale); + nrm = lerp(nrm, tex2D (_SplatNormal4, UV * _Splat4ScaleNormal), splat_control2.r); + nrm = lerp(nrm, tex2D (_SplatNormal5, UV * _Splat5ScaleNormal), splat_control2.g); + nrm = lerp(nrm, tex2D (_SplatNormal6, UV * _Splat6ScaleNormal), splat_control2.b); + nrm = lerp(nrm, tex2D (_SplatNormal7, UV * _Splat7ScaleNormal), splat_control2.a); + + + nrm.b = 1; + nrm.rgb = nrm.rgb * 2 - half3(1, 1, 1); + nrm.rgb = normalize(nrm.rgb); + + //float4 col = tex2D (_SplatLower, UV * _LowerScale); + float4 col = tex2D (_Splat4XP, UV * _Splat4Scale); + //col = lerp(col, tex2D (_Splat4XP, UV * _Splat4Scale), splat_control2.r); + col = lerp(col, tex2D (_Splat5XP, UV * _Splat5Scale), splat_control2.g); + col = lerp(col, tex2D (_Splat6XP, UV * _Splat6Scale), splat_control2.b); + col = lerp(col, tex2D (_Splat7XP, UV * _Splat7Scale), splat_control2.a); + float4 UpperAlbedo = tex2D (_SplatUpper, UV * _UpperScale); + col = lerp(col, UpperAlbedo, UpperAlbedo.a); + + + if(_Slope > 0){ + if(IN.worldPos.y < _WaterLevel){ + if(IN.SlopeLerp > 0.75) col.rgb = half3(0,0.4,1); + else col.rgb = half3(0.6,0,1); + } + else if(IN.SlopeLerp > 0.99) col.rgb = half3(0,0.8,0); + else if(IN.SlopeLerp > 0.85) col.rgb = half3(0.5,1,0); + else col.rgb = half3(1,0,0); + o.Albedo = col; + } + else if(_Water > 0) o.Albedo = ApplyWaterColor(WaterDepth, col.rgb); + else o.Albedo = col; + + + o.Gloss = 0; + o.Specular = 0; + //o.Alpha = 1; + o.Alpha = splat_control2.r + splat_control2.g + splat_control2.b + splat_control2.a; + } + ENDCG + + Blend One One + CGPROGRAM + #pragma surface surf Lambert nofog + + struct Input { + float2 uv_Control : TEXCOORD0; + float3 worldPos; + float SlopeLerp; + }; + + void vert (inout appdata_full v, out Input o){ + UNITY_INITIALIZE_OUTPUT(Input,o); + //v.tangent.xyz = cross(v.normal, float3(0,0,1)); + //v.tangent.w = -1; + o.SlopeLerp = dot(v.normal, half3(0,1,0)); + } + + + half _GridScale; + half _GridCamDist; + sampler2D _GridTexture; + int _Grid; + int _Slope; + half _WaterLevel; + + void surf (Input IN, inout SurfaceOutput o) { + o.Albedo = fixed4(0,0,0,1); + o.Emission = fixed4(0,0,0,0); + + half4 col = half4(0,0,0,1); + + + if(_Grid > 0){ + fixed4 GridColor = tex2D (_GridTexture, IN.uv_Control * _GridScale - float2(-0.00, -0.00)); + fixed4 GridFinal = fixed4(0,0,0,GridColor.a); + if(_GridCamDist < 1){ + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(1,1,1), GridColor.r * lerp(1, 0, _GridCamDist)); + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.g * lerp(1, 0, _GridCamDist)); + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b * lerp(0, 1, _GridCamDist)); + } + else{ + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b); + } + + col.rgb = lerp(col.rgb, GridFinal.rgb, GridColor.a); + o.Emission = GridFinal * GridColor.a; + } + o.Emission = col.rgb; + } + ENDCG + + Blend One One + CGPROGRAM + #pragma surface surf Lambert nofog + + struct Input { + float2 uv_Control : TEXCOORD0; + }; + + + int _Brush; + sampler2D _BrushTex; + half _BrushSize; + half _BrushUvX; + half _BrushUvY; + half _GridScale; + + void surf (Input IN, inout SurfaceOutput o) { + o.Albedo = fixed4(0,0,0,1); + o.Emission = fixed4(0,0,0,0); + + + if(_Brush > 0){ + fixed4 BrushColor = tex2D (_BrushTex, ((IN.uv_Control - float2(_BrushUvX, _BrushUvY)) * _GridScale) / (_BrushSize * _GridScale * 0.002) ); + + if(BrushColor.r > 0.1f && BrushColor.r < 0.12f){ + o.Emission += half3(0, BrushColor.r * 1.2, BrushColor.r * 4); + } + + o.Emission += half3(0, BrushColor.r * 0.1, BrushColor.r * 0.2); + } + } + ENDCG + + Blend DstColor Zero + CGPROGRAM + #pragma surface surf Lambert nofog + + struct Input { + float3 worldPos; + }; + + int _Area; + + half _AreaX; + half _AreaY; + half _AreaWidht; + half _AreaHeight; + half _GridScale; + + void surf (Input IN, inout SurfaceOutput o) { + o.Albedo = fixed4(0,0,0,1); + o.Emission = fixed4(1,1,1,1); + if(_Area > 0){ + fixed4 dark = fixed4(0.05, 0.05, 0.05, 1); + if(IN.worldPos.x < _AreaX){ + o.Emission = fixed4(0,0,0,1); + } + else if(IN.worldPos.x > _AreaWidht){ + o.Emission = fixed4(0,0,0,1); + } + else if(IN.worldPos.z < _AreaY - _GridScale){ + o.Emission = fixed4(0,0,0,1); + } + else if(IN.worldPos.z > _AreaHeight - _GridScale){ + o.Emission = fixed4(0,0,0,1); + } + } + } + ENDCG + +} + + +FallBack "Diffuse" +} diff --git a/Assets/GFX/Shaders/Backup/FaTerrainShaderOld.shader.meta b/Assets/GFX/Shaders/Backup/FaTerrainShaderOld.shader.meta new file mode 100644 index 00000000..0426fe86 --- /dev/null +++ b/Assets/GFX/Shaders/Backup/FaTerrainShaderOld.shader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: a760ca39bde832349bb6ffb0e84caf93 +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/Resources.meta b/Assets/GFX/Shaders/Deferred.meta similarity index 51% rename from Assets/Resources.meta rename to Assets/GFX/Shaders/Deferred.meta index 445ef1cb..51a891cb 100644 --- a/Assets/Resources.meta +++ b/Assets/GFX/Shaders/Deferred.meta @@ -1,9 +1,10 @@ fileFormatVersion: 2 -guid: 76ef4ecdcdbbb2c48a593e9ef426adbf +guid: 9b222392f2e89f044b3a794a411f7669 folderAsset: yes -timeCreated: 1503583155 -licenseType: Pro +timeCreated: 1513880117 +licenseType: Free DefaultImporter: + externalObjects: {} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Resources/Internal-DeferredShading.shader b/Assets/GFX/Shaders/Deferred/Internal-DeferredShading.shader similarity index 100% rename from Assets/Resources/Internal-DeferredShading.shader rename to Assets/GFX/Shaders/Deferred/Internal-DeferredShading.shader diff --git a/Assets/Resources/Internal-DeferredShading.shader.meta b/Assets/GFX/Shaders/Deferred/Internal-DeferredShading.shader.meta similarity index 70% rename from Assets/Resources/Internal-DeferredShading.shader.meta rename to Assets/GFX/Shaders/Deferred/Internal-DeferredShading.shader.meta index f450a45c..6bba988a 100644 --- a/Assets/Resources/Internal-DeferredShading.shader.meta +++ b/Assets/GFX/Shaders/Deferred/Internal-DeferredShading.shader.meta @@ -1,8 +1,9 @@ fileFormatVersion: 2 guid: 1070857f4547f784c82bc2f780f26d01 -timeCreated: 1503580178 -licenseType: Pro +timeCreated: 1513880156 +licenseType: Free ShaderImporter: + externalObjects: {} defaultTextures: [] userData: assetBundleName: diff --git a/Assets/Resources/UnityDeprecatedEX.cginc b/Assets/GFX/Shaders/Deferred/UnityDeprecatedEX.cginc similarity index 100% rename from Assets/Resources/UnityDeprecatedEX.cginc rename to Assets/GFX/Shaders/Deferred/UnityDeprecatedEX.cginc diff --git a/Assets/Resources/UnityDeprecatedEX.cginc.meta b/Assets/GFX/Shaders/Deferred/UnityDeprecatedEX.cginc.meta similarity index 100% rename from Assets/Resources/UnityDeprecatedEX.cginc.meta rename to Assets/GFX/Shaders/Deferred/UnityDeprecatedEX.cginc.meta diff --git a/Assets/Resources/UnityPBSLighting.cginc b/Assets/GFX/Shaders/Deferred/UnityPBSLighting.cginc similarity index 100% rename from Assets/Resources/UnityPBSLighting.cginc rename to Assets/GFX/Shaders/Deferred/UnityPBSLighting.cginc diff --git a/Assets/Resources/UnityPBSLighting.cginc.meta b/Assets/GFX/Shaders/Deferred/UnityPBSLighting.cginc.meta similarity index 100% rename from Assets/Resources/UnityPBSLighting.cginc.meta rename to Assets/GFX/Shaders/Deferred/UnityPBSLighting.cginc.meta diff --git a/Assets/Resources/UnityStandardBRDFCustom.cginc b/Assets/GFX/Shaders/Deferred/UnityStandardBRDFCustom.cginc similarity index 100% rename from Assets/Resources/UnityStandardBRDFCustom.cginc rename to Assets/GFX/Shaders/Deferred/UnityStandardBRDFCustom.cginc diff --git a/Assets/Resources/UnityStandardBRDFCustom.cginc.meta b/Assets/GFX/Shaders/Deferred/UnityStandardBRDFCustom.cginc.meta similarity index 100% rename from Assets/Resources/UnityStandardBRDFCustom.cginc.meta rename to Assets/GFX/Shaders/Deferred/UnityStandardBRDFCustom.cginc.meta diff --git a/Assets/GFX/Shaders/FaTerrainShader.shader b/Assets/GFX/Shaders/FaTerrainShader.shader index 6c26de4e..9a4f773b 100644 --- a/Assets/GFX/Shaders/FaTerrainShader.shader +++ b/Assets/GFX/Shaders/FaTerrainShader.shader @@ -7,36 +7,33 @@ Properties { [MaterialToggle] _Water("Has Water", Int) = 0 [MaterialToggle] _Grid("Grid", Int) = 0 [MaterialToggle] _Slope("Slope", Int) = 0 + [MaterialToggle] _UseSlopeTex("Use Slope Data", Int) = 0 + _SlopeTex ("Slope data", 2D) = "black" {} + [MaterialToggle] _TTerrainXP("_TTerrainXP", Int) = 0 - _LightingMultiplier ("LightingMultiplier ", Range (0, 10)) = 1 - _SunColor ("Sun Color", Color) = (0.5, 0.5, 0.5, 1) - _SunAmbience ("Ambience Color", Color) = (0.5, 0.5, 0.5, 1) - _ShadowColor ("Shadow Color", Color) = (0.5, 0.5, 0.5, 1) + _WaterLevel ("Water Level", float) = 0.078125 + _DepthLevel ("Depth Level", float) = 0.078125 + _AbyssLevel ("Abyss Level", float) = 0.078125 - - _WaterRam ("Control (RGBA)", 2D) = "blue" {} - _WaterLevel ("Water Level", Range (0.03, 5)) = 0.078125 - _AbyssLevel ("Abyss Level", Range (0.03, 5)) = 0.078125 - - [MaterialToggle] _Area("Area", Int) = 0 - _AreaX ("Area X", Range (0, 2048)) = 0 - _AreaY ("Area Y", Range (0, 2048)) = 0 - _AreaWidht ("Area Widht", Range (0, 2048)) = 0 - _AreaHeight ("Area Height", Range (0, 2048)) = 0 - // set by terrain engine _Control ("Control (RGBA)", 2D) = "black" {} _ControlXP ("ControlXP (RGBA)", 2D) = "black" {} _Control2XP ("Control2XP (RGBA)", 2D) = "black" {} - _Splat0XP ("Layer 1 (R)", 2D) = "black" {} - _Splat1XP ("Layer 2 (G)", 2D) = "black" {} - _Splat2XP ("Layer 3 (B)", 2D) = "black" {} - _Splat3XP ("Layer 4 (A)", 2D) = "black" {} - _Splat4XP ("Layer 5 (R)", 2D) = "black" {} - _Splat5XP ("Layer 6 (G)", 2D) = "black" {} - _Splat6XP ("Layer 7 (B)", 2D) = "black" {} - _Splat7XP ("Layer 8 (A)", 2D) = "black" {} + + [MaterialToggle] _HideSplat0("Hide splat 2", Int) = 0 + [MaterialToggle] _HideSplat1("Hide splat 2", Int) = 0 + [MaterialToggle] _HideSplat2("Hide splat 3", Int) = 0 + [MaterialToggle] _HideSplat3("Hide splat 4", Int) = 0 + [MaterialToggle] _HideSplat4("Hide splat 5", Int) = 0 + [MaterialToggle] _HideSplat5("Hide splat 6", Int) = 0 + [MaterialToggle] _HideSplat6("Hide splat 7", Int) = 0 + [MaterialToggle] _HideSplat7("Hide splat 8", Int) = 0 + [MaterialToggle] _HideSplat8("Hide splat Upper", Int) = 0 + + _SplatAlbedoArray ("Albedo array", 2DArray) = "" {} + _SplatNormalArray ("Normal array", 2DArray) = "" {} + _Splat0Scale ("Splat1 Level", Range (1, 1024)) = 10 _Splat1Scale ("Splat2 Level", Range (1, 1024)) = 10 @@ -48,14 +45,9 @@ Properties { _Splat7Scale ("Splat8 Level", Range (1, 1024)) = 10 // set by terrain engine - _SplatNormal0 ("Normal 1 (A)", 2D) = "bump" {} - _SplatNormal1 ("Normal 2 (B)", 2D) = "bump" {} - _SplatNormal2 ("Normal 3 (G)", 2D) = "bump" {} - _SplatNormal3 ("Normal 4 (R)", 2D) = "bump" {} - _SplatNormal4 ("Normal 5 (A)", 2D) = "bump" {} - _SplatNormal5 ("Normal 6 (B)", 2D) = "bump" {} - _SplatNormal6 ("Normal 7 (G)", 2D) = "bump" {} - _SplatNormal7 ("Normal 8 (R)", 2D) = "bump" {} + [MaterialToggle] _GeneratingNormal("Generating Normal", Int) = 0 + _TerrainNormal ("Terrain Normal", 2D) = "bump" {} + _Splat0ScaleNormal ("Splat1 Normal Level", Range (1, 1024)) = 10 _Splat1ScaleNormal ("Splat2 Normal Level", Range (1, 1024)) = 10 @@ -90,18 +82,24 @@ Properties { _GridScale ("Grid Scale", Range (0, 2048)) = 512 _GridTexture ("Grid Texture", 2D) = "white" {} - _GridCamDist ("Grid Scale", Range (0, 10)) = 5 + //_GridCamDist ("Grid Scale", Range (0, 10)) = 5 + //_WaterScaleX ("Water Scale X", float) = 1024 + //_WaterScaleZ ("Water Scale Z", float) = 1024 } SubShader { - Tags { "Queue"="Geometry" } - CGPROGRAM - #pragma surface surf SimpleLambert vertex:vert noambient fullforwardshadows addshadow nometa + #define UNITY_BRDF_PBS BRDF3_Unity_PBS + + #pragma surface surf SimpleLambert vertex:vert fullforwardshadows addshadow nometa //#pragma debug - #pragma target 4.0 + #pragma target 3.5 #pragma exclude_renderers gles + #include "UnityLightingCommon.cginc" + #include "UnityGBuffer.cginc" + #include "UnityGlobalIllumination.cginc" + #include "Assets/GFX/Shaders/SimpleLambert.cginc" struct Input { float2 uv_Control : TEXCOORD0; @@ -110,12 +108,18 @@ Properties { float4 grabUV; }; + half _GeneratingNormal; + void vert (inout appdata_full v, out Input o){ UNITY_INITIALIZE_OUTPUT(Input,o); + + o.SlopeLerp = dot(v.normal, half3(0,1,0)); + + if(_GeneratingNormal == 0) + v.normal = float3(0,1,0); v.tangent.xyz = cross(v.normal, float3(0,0,1)); v.tangent.w = -1; //o.normal = v.normal; - o.SlopeLerp = dot(v.normal, half3(0,1,0)); float4 hpos = UnityObjectToClipPos (v.vertex); o.grabUV = ComputeGrabScreenPos(hpos); //v.color = _Abyss; @@ -125,338 +129,295 @@ Properties { sampler2D _WaterRam; half _Shininess; half _WaterLevel; - half _AbyssLevel; + half _DepthLevel, _AbyssLevel; fixed4 _Abyss; fixed4 _Deep; int _Water; - int _Slope; + int _Slope, _UseSlopeTex; + sampler2D _SlopeTex; - half _LightingMultiplier; - fixed4 _SunColor; - fixed4 _SunAmbience; - fixed4 _ShadowColor; + int _Grid; + half _GridScale; + half _GridCamDist; + sampler2D _GridTexture; + //uniform sampler2D _ControlXP; - //sampler2D _Control2XP; - sampler2D _Splat0XP, _Splat1XP, _Splat2XP, _Splat3XP, _SplatLower; - half _LowerScale; - half _Splat0Scale, _Splat1Scale, _Splat2Scale, _Splat3Scale; + sampler2D _Control2XP; + uniform sampler2D _UtilitySamplerC; + sampler2D _TerrainNormal; + sampler2D _SplatLower, _SplatUpper; + sampler2D _NormalLower; + //sampler2D _SplatNormal0, _SplatNormal1, _SplatNormal2, _SplatNormal3, _SplatNormal4, _SplatNormal5, _SplatNormal6, _SplatNormal7; + half _Splat0Scale, _Splat1Scale, _Splat2Scale, _Splat3Scale, _Splat4Scale, _Splat5Scale, _Splat6Scale, _Splat7Scale; + half _Splat0ScaleNormal, _Splat1ScaleNormal, _Splat2ScaleNormal, _Splat3ScaleNormal, _Splat4ScaleNormal, _Splat5ScaleNormal, _Splat6ScaleNormal, _Splat7ScaleNormal; + + UNITY_DECLARE_TEX2DARRAY(_SplatAlbedoArray); + UNITY_DECLARE_TEX2DARRAY(_SplatNormalArray); - sampler2D _SplatNormal0, _SplatNormal1, _SplatNormal2, _SplatNormal3, _NormalLower; - half _Splat0ScaleNormal, _Splat1ScaleNormal, _Splat2ScaleNormal, _Splat3ScaleNormal; + int _HideSplat0, _HideSplat1, _HideSplat2, _HideSplat3, _HideSplat4, _HideSplat5, _HideSplat6, _HideSplat7, _HideSplat8; + + half _LowerScale, _UpperScale; + fixed _TTerrainXP; + uniform float _WaterScaleX, _WaterScaleZ; - float4 LightingSimpleLambert (SurfaceOutput s, float3 lightDir, half atten) { - float NdotL = dot (lightDir, s.Normal); - - float4 c; - float3 spec = float3(0,0,0); + int _Brush; + sampler2D _BrushTex; + half _BrushSize; + half _BrushUvX; + half _BrushUvY; - float3 light = _SunColor.rgb * 2 * saturate(NdotL) * atten + _SunAmbience.rgb * 2; - light = _LightingMultiplier * light + _ShadowColor.rgb * 2 * (1 - light); + uniform int _Area; + uniform half4 _AreaRect; - c.rgb = (s.Albedo + spec) * light; - c.a = s.Alpha; - return c; - } float3 ApplyWaterColor( float depth, float3 inColor){ float4 wcolor = tex2D(_WaterRam, float2(depth,0)); return lerp( inColor.rgb, wcolor.rgb, wcolor.a ); + //return inColor.rgb; + //return inColor; } - void surf (Input IN, inout SurfaceOutput o) { - float WaterDepth = (_WaterLevel - IN.worldPos.y) / (_WaterLevel - _AbyssLevel); - float2 UV = IN.uv_Control * fixed2(1, -1); - float4 splat_control = saturate(tex2D (_ControlXP, UV) * 2 - 1); - //float4 splat_control2 = saturate(tex2D (_Control2XP, UV) * 2 - 1); - - half4 nrm; - nrm = tex2D (_NormalLower, UV * _LowerScale); - nrm = lerp(nrm, tex2D (_SplatNormal0, UV * _Splat0ScaleNormal), splat_control.r); - nrm = lerp(nrm, tex2D (_SplatNormal1, UV * _Splat1ScaleNormal), splat_control.g); - nrm = lerp(nrm, tex2D (_SplatNormal2, UV * _Splat2ScaleNormal), splat_control.b); - nrm = lerp(nrm, tex2D (_SplatNormal3, UV * _Splat3ScaleNormal), splat_control.a); - - - nrm.b = 1; - nrm.rgb = nrm.rgb * 2 - half3(1, 1, 1); - nrm.rgb = normalize(nrm.rgb); + inline fixed3 UnpackNormalDXT5nmScaled (fixed4 packednormal, fixed scale) +{ + fixed3 normal = 0; + normal.xz = packednormal.wx * 2 - 1; - float4 col = tex2D (_SplatLower, UV * _LowerScale); - col = lerp(col, tex2D (_Splat0XP, UV * _Splat0Scale), splat_control.r); - col = lerp(col, tex2D (_Splat1XP, UV * _Splat1Scale), splat_control.g); - col = lerp(col, tex2D (_Splat2XP, UV * _Splat2Scale), splat_control.b); - col = lerp(col, tex2D (_Splat3XP, UV * _Splat3Scale), splat_control.a); - if(_Slope > 0){ - if(IN.worldPos.y < _WaterLevel){ - if(IN.SlopeLerp > 0.75) col.rgb = half3(0,0.4,1); - else col.rgb = half3(0.6,0,1); - } - else if(IN.SlopeLerp > 0.99) col.rgb = half3(0,0.8,0); - else if(IN.SlopeLerp > 0.85) col.rgb = half3(0.5,1,0); - else col.rgb = half3(1,0,0); - o.Albedo = col; - } - else if(_Water > 0) o.Albedo = ApplyWaterColor(WaterDepth, col.rgb); - else o.Albedo = col; + normal.y = sqrt(1 - saturate(dot(normal.xz, normal.xz))); + normal.xz *= scale; - o.Gloss = 0; - o.Specular = 0; - o.Alpha = 1; - //o.Alpha = splat_control.r + splat_control.g + splat_control.b + splat_control.a; + + return normal.xzy; } - ENDCG - - - - //******************** 2 - - Blend One OneMinusSrcAlpha - CGPROGRAM - #pragma surface surf SimpleLambert vertex:vert alpha noambient fullforwardshadows addshadow nometa - //#pragma debug - #pragma target 4.0 - #pragma exclude_renderers gles - struct Input { - float2 uv_Control : TEXCOORD0; - float3 worldPos; - float SlopeLerp; - float4 grabUV; - }; - - void vert (inout appdata_full v, out Input o){ - UNITY_INITIALIZE_OUTPUT(Input,o); - v.tangent.xyz = cross(v.normal, float3(0,0,1)); - v.tangent.w = -1; - //o.normal = v.normal; - o.SlopeLerp = dot(v.normal, half3(0,1,0)); - float4 hpos = UnityObjectToClipPos (v.vertex); - o.grabUV = ComputeGrabScreenPos(hpos); - //v.color = _Abyss; - } + void surf (Input IN, inout SurfaceOutput o) { - sampler2D _MyGrabTexture3; - sampler2D _WaterRam; - half _Shininess; - half _WaterLevel; - half _AbyssLevel; - fixed4 _Abyss; - fixed4 _Deep; - int _Water; + float4 waterTexture = tex2D( _UtilitySamplerC, IN.uv_Control * float2(1, -1) + float2(1 / (_WaterScaleX * 1), 1 / (_WaterScaleZ * 1) + 1)); - int _Slope; + //float WaterDepth = (_WaterLevel - IN.worldPos.y) / (_WaterLevel - _AbyssLevel); + float WaterDepth = waterTexture.g; + float2 UVCtrl = IN.uv_Control * fixed2(1, -1) + half2(0, 1); + float2 UV = IN.uv_Control * fixed2(1, -1) + half2(0, 1); + //float2 UV = IN.uv_Control * half2(1, -1) + half2(0, 1); + float4 splat_control = saturate(tex2D (_ControlXP, UVCtrl) * 2 - 1); + float4 splat_control2 = saturate(tex2D (_Control2XP, UVCtrl) * 2 - 1); - half _LightingMultiplier; - fixed4 _SunColor; - fixed4 _SunAmbience; - fixed4 _ShadowColor; + //float4 col = tex2Dproj( _MyGrabTexture3, UNITY_PROJ_COORD(IN.grabUV)); - //sampler2D _ControlXP; - sampler2D _Control2XP; - sampler2D _Splat4XP, _Splat5XP, _Splat6XP, _Splat7XP, _SplatLower, _SplatUpper; - half _LowerScale, _UpperScale; - half _Splat0Scale, _Splat1Scale, _Splat2Scale, _Splat3Scale, _Splat4Scale, _Splat5Scale, _Splat6Scale, _Splat7Scale; + - sampler2D _SplatNormal0, _SplatNormal1, _SplatNormal2, _SplatNormal3, _NormalLower; - sampler2D _SplatNormal4, _SplatNormal5, _SplatNormal6, _SplatNormal7; - half _Splat0ScaleNormal, _Splat1ScaleNormal, _Splat2ScaleNormal, _Splat3ScaleNormal, _Splat4ScaleNormal, _Splat5ScaleNormal, _Splat6ScaleNormal, _Splat7ScaleNormal; + float4 col = tex2D(_SplatLower, UV * _LowerScale); + + if(_HideSplat0 == 0) + //col = lerp(col, tex2D(_Splat0XP, UV * _Splat0Scale), splat_control.r); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat0Scale, 0)), splat_control.r); + if(_HideSplat1 == 0) + //col = lerp(col, tex2D(_Splat1XP, UV * _Splat1Scale), splat_control.g); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat1Scale, 1)), splat_control.g); + if(_HideSplat2 == 0) + //col = lerp(col, tex2D(_Splat2XP, UV * _Splat2Scale), splat_control.b); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat2Scale, 2)), splat_control.b); + if(_HideSplat3 == 0) + //col = lerp(col, tex2D(_Splat3XP, UV * _Splat3Scale), splat_control.a); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat3Scale, 3)), splat_control.a); + + if (_TTerrainXP > 0) { + if(_HideSplat4 == 0) + //col = lerp(col, tex2D(_Splat4XP, UV * _Splat4Scale), splat_control2.r); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat4Scale, 4)), splat_control2.r); + if(_HideSplat5 == 0) + //col = lerp(col, tex2D(_Splat5XP, UV * _Splat5Scale), splat_control2.g); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat5Scale, 5)), splat_control2.g); + if(_HideSplat6 == 0) + //col = lerp(col, tex2D(_Splat6XP, UV * _Splat6Scale), splat_control2.b); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat6Scale, 6)), splat_control2.b); + if(_HideSplat7 == 0) + //col = lerp(col, tex2D(_Splat7XP, UV * _Splat7Scale), splat_control2.a); + col = lerp(col, UNITY_SAMPLE_TEX2DARRAY(_SplatAlbedoArray, float3(UV * _Splat7Scale, 7)), splat_control2.a); + } - float4 LightingSimpleLambert (SurfaceOutput s, float3 lightDir, half atten) { - float NdotL = dot (lightDir, s.Normal); - - float4 c; - float3 spec = float3(0,0,0); + if(_HideSplat8 == 0){ + float4 UpperAlbedo = tex2D (_SplatUpper, UV * _UpperScale); + col = lerp(col, UpperAlbedo, UpperAlbedo.a); + } - float3 light = _SunColor.rgb * 2 * saturate(NdotL) * atten + _SunAmbience.rgb * 2; - light = _LightingMultiplier * light + _ShadowColor.rgb * 2 * (1 - light); - c.rgb = (s.Albedo + spec) * light; - c.a = s.Alpha; - return c; - } - float3 ApplyWaterColor( float depth, float3 inColor){ - float4 wcolor = tex2D(_WaterRam, float2(depth,0)); - return lerp( inColor.rgb, wcolor.rgb, wcolor.a ); - } - void surf (Input IN, inout SurfaceOutput o) { - float WaterDepth = (_WaterLevel - IN.worldPos.y) / (_WaterLevel - _AbyssLevel); - float2 UV = IN.uv_Control * fixed2(1, -1); - //float4 splat_control = saturate(tex2D (_ControlXP, UV) * 2 - 1); - float4 splat_control2 = saturate(tex2D (_Control2XP, UV) * 2 - 1); + //col = 1; half4 nrm; + //UV *= 0.01; nrm = tex2D (_NormalLower, UV * _LowerScale); - nrm = lerp(nrm, tex2D (_SplatNormal4, UV * _Splat4ScaleNormal), splat_control2.r); - nrm = lerp(nrm, tex2D (_SplatNormal5, UV * _Splat5ScaleNormal), splat_control2.g); - nrm = lerp(nrm, tex2D (_SplatNormal6, UV * _Splat6ScaleNormal), splat_control2.b); - nrm = lerp(nrm, tex2D (_SplatNormal7, UV * _Splat7ScaleNormal), splat_control2.a); - - - nrm.b = 1; - nrm.rgb = nrm.rgb * 2 - half3(1, 1, 1); - nrm.rgb = normalize(nrm.rgb); - - //float4 col = tex2D (_SplatLower, UV * _LowerScale); - float4 col = tex2D (_Splat4XP, UV * _Splat4Scale); - //col = lerp(col, tex2D (_Splat4XP, UV * _Splat4Scale), splat_control2.r); - col = lerp(col, tex2D (_Splat5XP, UV * _Splat5Scale), splat_control2.g); - col = lerp(col, tex2D (_Splat6XP, UV * _Splat6Scale), splat_control2.b); - col = lerp(col, tex2D (_Splat7XP, UV * _Splat7Scale), splat_control2.a); - float4 UpperAlbedo = tex2D (_SplatUpper, UV * _UpperScale); - col = lerp(col, UpperAlbedo, UpperAlbedo.a); - - - if(_Slope > 0){ - if(IN.worldPos.y < _WaterLevel){ - if(IN.SlopeLerp > 0.75) col.rgb = half3(0,0.4,1); - else col.rgb = half3(0.6,0,1); - } - else if(IN.SlopeLerp > 0.99) col.rgb = half3(0,0.8,0); - else if(IN.SlopeLerp > 0.85) col.rgb = half3(0.5,1,0); - else col.rgb = half3(1,0,0); - o.Albedo = col; + if(_HideSplat0 == 0) + //nrm = lerp(nrm, tex2D (_SplatNormal0, UV * _Splat0ScaleNormal), splat_control.r); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat0ScaleNormal, 0)), splat_control.r); + if(_HideSplat1 == 0) + //nrm = lerp(nrm, tex2D (_SplatNormal1, UV * _Splat1ScaleNormal), splat_control.g); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat1ScaleNormal, 1)), splat_control.g); + if(_HideSplat2 == 0) + //nrm = lerp(nrm, tex2D (_SplatNormal2, UV * _Splat2ScaleNormal), splat_control.b); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat2ScaleNormal, 2)), splat_control.b); + if(_HideSplat3 == 0) + //nrm = lerp(nrm, tex2D (_SplatNormal3, UV * _Splat3ScaleNormal), splat_control.a); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat3ScaleNormal, 3)), splat_control.a); + + if (_TTerrainXP > 0) { + if(_HideSplat4 == 0) + //nrm = lerp(nrm, tex2D(_SplatNormal4, UV * _Splat4ScaleNormal), splat_control2.r); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat4ScaleNormal, 4)), splat_control2.r); + if(_HideSplat5 == 0) + //nrm = lerp(nrm, tex2D(_SplatNormal5, UV * _Splat5ScaleNormal), splat_control2.g); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat5ScaleNormal, 5)), splat_control2.g); + if(_HideSplat6 == 0) + //nrm = lerp(nrm, tex2D(_SplatNormal6, UV * _Splat6ScaleNormal), splat_control2.b); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat6ScaleNormal, 6)), splat_control2.b); + if(_HideSplat7 == 0) + //nrm = lerp(nrm, tex2D(_SplatNormal7, UV * _Splat7ScaleNormal), splat_control2.a); + nrm = lerp(nrm, UNITY_SAMPLE_TEX2DARRAY(_SplatNormalArray, float3(UV * _Splat7ScaleNormal, 7)), splat_control2.a); } - else if(_Water > 0) o.Albedo = ApplyWaterColor(WaterDepth, col.rgb); - else o.Albedo = col; - o.Gloss = 0; - o.Specular = 0; - //o.Alpha = 1; - o.Alpha = splat_control2.r + splat_control2.g + splat_control2.b + splat_control2.a; - } - ENDCG - Blend One One - CGPROGRAM - #pragma surface surf Lambert nofog - - struct Input { - float2 uv_Control : TEXCOORD0; - float3 worldPos; - float SlopeLerp; - }; - - void vert (inout appdata_full v, out Input o){ - UNITY_INITIALIZE_OUTPUT(Input,o); - //v.tangent.xyz = cross(v.normal, float3(0,0,1)); - //v.tangent.w = -1; - o.SlopeLerp = dot(v.normal, half3(0,1,0)); - } + //nrm = tex2D (_NormalLower, UV * 1000); + //nrm.rg *= 5; + //nrm.b = 1; + //nrm.rgb = UnpackNormal(nrm); + //nrm.rgb = nrm.rgb * 2 - half3(1, 1, 1); + //nrm.rg *= 3; + //nrm.rgb = normalize(nrm.rgb); + //o.Normal = UnpackNormalDXT5nm(tex2D(_TerrainNormal, UV )); + //o.Normal = (UnpackNormalDXT5nm(tex2D(_TerrainNormal, UV )) + UnpackNormalDXT5nmScaled(nrm.rgbg, 2)); + if(_GeneratingNormal == 0){ + half4 TerrainNormal = tex2D(_TerrainNormal, UVCtrl ); + half3 TerrainNormalVector = UnpackNormalDXT5nm( half4(TerrainNormal.r, 1 - TerrainNormal.g, TerrainNormal.b, TerrainNormal.a)); + IN.SlopeLerp = dot(TerrainNormalVector, half3(0,0,1)); + //o.Albedo = IN.SlopeLerp; + o.Normal = BlendNormals(TerrainNormalVector , UnpackNormalDXT5nmScaled(nrm.rgbg, 1)); + } + else + o.Normal = UnpackNormalDXT5nmScaled(nrm.rgbg, 1); - half _GridScale; - half _GridCamDist; - sampler2D _GridTexture; - int _Grid; - int _Slope; - half _WaterLevel; - void surf (Input IN, inout SurfaceOutput o) { - o.Albedo = fixed4(0,0,0,1); - o.Emission = fixed4(0,0,0,0); + // o.Normal.y *= 0.5f; + //o.Normal = normalize(o.Normal); - half4 col = half4(0,0,0,1); + //half3 Emit = _SunAmbience.rgb * 2; + half3 Emit = 0; + if(_Slope > 0){ + o.Normal = half3(0,0,1); + half3 SlopeColor = 0; + if(_UseSlopeTex > 0){ + //col = 0; + float2 UV2 = IN.uv_Control * fixed2(1, 1) + half2(0, 0) - float2(-0.00, -0.00) / _GridScale; + float4 splat_control = tex2D (_SlopeTex, UV2); + SlopeColor = splat_control.rgb; - if(_Grid > 0){ - fixed4 GridColor = tex2D (_GridTexture, IN.uv_Control * _GridScale - float2(-0.00, -0.00)); - fixed4 GridFinal = fixed4(0,0,0,GridColor.a); - if(_GridCamDist < 1){ - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(1,1,1), GridColor.r * lerp(1, 0, _GridCamDist)); - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.g * lerp(1, 0, _GridCamDist)); - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b * lerp(0, 1, _GridCamDist)); + } + else{ + + if(IN.worldPos.y < _WaterLevel){ + if(IN.SlopeLerp > 0.75) SlopeColor = half3(0,0.4,1); + else SlopeColor = half3(0.6,0,1); } - else{ - GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b); + else if(IN.SlopeLerp > 0.999) SlopeColor = half3(0,0.8,0); + else if(IN.SlopeLerp > 0.95) SlopeColor = half3(0.3,0.89,0); + else if(IN.SlopeLerp > 0.80) SlopeColor = half3(0.5,0.8,0); + else SlopeColor = half3(1,0,0); + } - - col.rgb = lerp(col.rgb, GridFinal.rgb, GridColor.a); - o.Emission = GridFinal * GridColor.a; - } - o.Emission = col.rgb; + Emit = SlopeColor * 0.5; + col.rgb = lerp(col.rgb, SlopeColor, 0.5); } - ENDCG + else if(_Water > 0) col.rgb = ApplyWaterColor(WaterDepth, col.rgb); + - Blend One One - CGPROGRAM - #pragma surface surf Lambert nofog - - struct Input { - float2 uv_Control : TEXCOORD0; - }; + if(_Grid > 0){ + fixed4 GridColor = tex2D (_GridTexture, IN.uv_Control * _GridScale - float2(-0.00, -0.00)); + fixed4 GridFinal = fixed4(0,0,0,GridColor.a); + if(_GridCamDist < 1){ + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(1,1,1), GridColor.r * lerp(1, 0, _GridCamDist)); + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.g * lerp(1, 0, _GridCamDist)); + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b * lerp(0, 1, _GridCamDist)); + } + else{ + GridFinal.rgb = lerp(GridFinal.rgb, fixed3(0,1,0), GridColor.b); + } + + //col.rgb = lerp(col.rgb, GridFinal.rgb, GridColor.a); + Emit += GridFinal * GridColor.a; + } + if(_Brush > 0){ + fixed4 BrushColor = tex2D (_BrushTex, ((IN.uv_Control - float2(_BrushUvX, _BrushUvY)) * _GridScale) / (_BrushSize * _GridScale * 0.002) ); - int _Brush; - sampler2D _BrushTex; - half _BrushSize; - half _BrushUvX; - half _BrushUvY; - half _GridScale; + half LerpValue = clamp(_BrushSize / 20, 0, 1); - void surf (Input IN, inout SurfaceOutput o) { - o.Albedo = fixed4(0,0,0,1); - o.Emission = fixed4(0,0,0,0); + half From = 0.1f; + half To = lerp(0.2f, 0.13f, LerpValue); + half Range = lerp(0.015f, 0.008f, LerpValue); + if(BrushColor.r >= From && BrushColor.r <= To){ + half AA = 1; - if(_Brush > 0){ - fixed4 BrushColor = tex2D (_BrushTex, ((IN.uv_Control - float2(_BrushUvX, _BrushUvY)) * _GridScale) / (_BrushSize * _GridScale * 0.002) ); + if (BrushColor.r < From + Range) + AA = (BrushColor.r - From) / Range; + else if(BrushColor.r > To - Range) + AA = 1 - (BrushColor.r - (To - Range)) / Range; - if(BrushColor.r > 0.1f && BrushColor.r < 0.12f){ - o.Emission += half3(0, BrushColor.r * 1.2, BrushColor.r * 4); - } + AA = clamp(AA, 0, 1); - o.Emission += half3(0, BrushColor.r * 0.1, BrushColor.r * 0.2); + Emit += half3(0, 0.3, 1) * (AA * 0.8); } + + Emit += half3(0, BrushColor.r * 0.1, BrushColor.r * 0.2); } - ENDCG - - Blend DstColor Zero - CGPROGRAM - #pragma surface surf Lambert nofog - - struct Input { - float3 worldPos; - }; - - int _Area; - half _AreaX; - half _AreaY; - half _AreaWidht; - half _AreaHeight; - half _GridScale; - - void surf (Input IN, inout SurfaceOutput o) { - o.Albedo = fixed4(0,0,0,1); - o.Emission = fixed4(1,1,1,1); - if(_Area > 0){ - fixed4 dark = fixed4(0.05, 0.05, 0.05, 1); - if(IN.worldPos.x < _AreaX){ - o.Emission = fixed4(0,0,0,1); - } - else if(IN.worldPos.x > _AreaWidht){ - o.Emission = fixed4(0,0,0,1); - } - else if(IN.worldPos.z < _AreaY - _GridScale){ - o.Emission = fixed4(0,0,0,1); - } - else if(IN.worldPos.z > _AreaHeight - _GridScale){ - o.Emission = fixed4(0,0,0,1); - } + + + o.Albedo = col; + o.Emission = Emit; + + if(_Area > 0){ + fixed3 BlackEmit = -1; + fixed3 Albedo = 0; + if(IN.worldPos.x < _AreaRect.x){ + o.Emission = BlackEmit; + o.Albedo = Albedo; + } + else if(IN.worldPos.x > _AreaRect.z){ + o.Emission = BlackEmit; + o.Albedo = Albedo; + } + else if(IN.worldPos.z < _AreaRect.y - _GridScale){ + o.Emission = BlackEmit; + o.Albedo = Albedo; + } + else if(IN.worldPos.z > _AreaRect.w - _GridScale){ + o.Emission = BlackEmit; + o.Albedo = Albedo; } } - ENDCG + + //o.Albedo = 0.5; + //o.Emission = tex2D (_SplatNormal3, UV * 10 ); + //o.Emission = nrm; + + o.Gloss = 0; + o.Specular = 0; + o.Alpha = 1; + } + ENDCG + } diff --git a/Assets/GFX/Shaders/FaTerrainShader.shader.meta b/Assets/GFX/Shaders/FaTerrainShader.shader.meta index 0426fe86..3846367c 100644 --- a/Assets/GFX/Shaders/FaTerrainShader.shader.meta +++ b/Assets/GFX/Shaders/FaTerrainShader.shader.meta @@ -1,5 +1,9 @@ fileFormatVersion: 2 -guid: a760ca39bde832349bb6ffb0e84caf93 +guid: 07332981e20e66d40a9ee102d13a9be8 +timeCreated: 1505636252 +licenseType: Free ShaderImporter: defaultTextures: [] userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GFX/Terrain/EmptyTerrain.mat b/Assets/GFX/Terrain/EmptyTerrain.mat new file mode 100644 index 00000000..4820f916 --- /dev/null +++ b/Assets/GFX/Terrain/EmptyTerrain.mat @@ -0,0 +1,313 @@ +%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: EmptyTerrain + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _AREA_ON _EMISSION _WATER_ON + m_LightmapFlags: 1 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BrushTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Control: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Control2: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Control2XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ControlXP: + 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} + - _GridTexture: + m_Texture: {fileID: 2800000, guid: 73e3d60bfbccd0548b778fb57562d7de, type: 3} + 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} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal0: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal0XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal1: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal1XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal2: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal2XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal3: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal3XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal4: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal5: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal6: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Normal7: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalLower: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalUpper: + 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} + - _Splat0: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat0XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat1: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat1XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat2: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat2XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat3: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat3XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat4: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat4XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat5: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat5XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat6: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat6XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat7: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Splat7XP: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatLower: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal0: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal1: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal2: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal3: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal4: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal5: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal6: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatNormal7: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SplatUpper: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _UtilitySamplerC: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _WaterRam: + m_Texture: {fileID: 2800000, guid: 98cd8e67656329e449bc5d7122271921, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AbyssLevel: 0.9001621 + - _Area: 1 + - _AreaHeight: 102.35 + - _AreaWidht: 102.35 + - _AreaX: 0.05 + - _AreaY: 0.05 + - _Brush: 0 + - _BrushSize: 20 + - _BrushUvX: -0.016466754 + - _BrushUvY: 0.34508404 + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DeepLevel: 1.675625 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.171 + - _GlossyReflections: 1 + - _Grid: 0 + - _GridCamDist: 0.05091428 + - _GridScale: 102.4 + - _LightingMultiplier: 1.27 + - _LowerScale: 42.982716 + - _LowerScaleNormal: 42.982716 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.03 + - _Slope: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _Splat0Scale: 170.66667 + - _Splat0ScaleNormal: 72.57986 + - _Splat1Scale: 74.285706 + - _Splat1ScaleNormal: 40.36529 + - _Splat2Scale: 92.52949 + - _Splat2ScaleNormal: 92.52949 + - _Splat3Scale: 99.902435 + - _Splat3ScaleNormal: 99.902435 + - _Splat4Scale: 99.902435 + - _Splat4ScaleNormal: 40.460197 + - _Splat5Scale: 136.9879 + - _Splat5ScaleNormal: 29.028221 + - _Splat6Scale: 256 + - _Splat6ScaleNormal: 256 + - _Splat7Scale: 23.153671 + - _Splat7ScaleNormal: 23.153671 + - _SrcBlend: 1 + - _UVSec: 0 + - _UpperScale: 50.514282 + - _UpperScaleNormal: 1024 + - _Water: 1 + - _WaterLevel: 2 + - _ZWrite: 1 + m_Colors: + - _Abyss: {r: 0.005190316, g: 0.051962737, b: 0.2352941, a: 1} + - _Color: {r: 0.15705165, g: 0.2205882, b: 0.10542818, a: 1} + - _Deep: {r: 0.22577855, g: 0.4590157, b: 0.5294118, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _ShadowColor: {r: 0.35, g: 0.35, b: 0.375, a: 1} + - _SpecColor: {r: 0, g: 0, b: 0, a: 0} + - _SunAmbience: {r: 0.2, g: 0.15, b: 0.1, a: 1} + - _SunColor: {r: 0.65, g: 0.5, b: 0.4, a: 1} diff --git a/Assets/GFX/Terrain/TerrainShader 1.mat.meta b/Assets/GFX/Terrain/EmptyTerrain.mat.meta similarity index 100% rename from Assets/GFX/Terrain/TerrainShader 1.mat.meta rename to Assets/GFX/Terrain/EmptyTerrain.mat.meta diff --git a/Assets/GFX/Terrain/ScmapTerrain.asset b/Assets/GFX/Terrain/ScmapTerrain.asset index 53944df3..d20c9106 100644 Binary files a/Assets/GFX/Terrain/ScmapTerrain.asset and b/Assets/GFX/Terrain/ScmapTerrain.asset differ diff --git a/Assets/GFX/Terrain/TerrainShader 1.mat b/Assets/GFX/Terrain/TerrainShader 1.mat deleted file mode 100644 index 223370b6..00000000 --- a/Assets/GFX/Terrain/TerrainShader 1.mat +++ /dev/null @@ -1,550 +0,0 @@ -%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: TerrainShader 1 - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: _AREA_ON _EMISSION _WATER_ON - m_LightmapFlags: 1 - m_CustomRenderQueue: -1 - stringTagMap: {} - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - - first: - name: _BrushTex - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _BumpMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Control - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Control2 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Control2XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _ControlXP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailAlbedoMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailMask - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailNormalMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _EmissionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _GridTexture - second: - m_Texture: {fileID: 2800000, guid: 73e3d60bfbccd0548b778fb57562d7de, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _MainTex - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _MetallicGlossMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal0 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal0XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal1 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal1XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal2 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal2XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal3 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal3XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal4 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal5 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal6 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Normal7 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _NormalLower - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _NormalUpper - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _OcclusionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _ParallaxMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat0 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat0XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat1 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat1XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat2 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat2XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat3 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat3XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat4 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat4XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat5 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat5XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat6 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat6XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat7 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _Splat7XP - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatLower - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal0 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal1 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal2 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal3 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal4 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal5 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal6 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatNormal7 - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _SplatUpper - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _UtilitySamplerC - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _WaterRam - second: - m_Texture: {fileID: 2800000, guid: 98cd8e67656329e449bc5d7122271921, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - first: - name: _AbyssLevel - second: 0.9001621 - - first: - name: _Area - second: 1 - - first: - name: _AreaHeight - second: 102.35 - - first: - name: _AreaWidht - second: 102.35 - - first: - name: _AreaX - second: 0.05 - - first: - name: _AreaY - second: 0.05 - - first: - name: _Brush - second: 0 - - first: - name: _BrushSize - second: 20 - - first: - name: _BrushUvX - second: -0.016466754 - - first: - name: _BrushUvY - second: 0.34508404 - - first: - name: _BumpScale - second: 1 - - first: - name: _Cutoff - second: 0.5 - - first: - name: _DeepLevel - second: 1.675625 - - first: - name: _DetailNormalMapScale - second: 1 - - first: - name: _DstBlend - second: 0 - - first: - name: _GlossMapScale - second: 1 - - first: - name: _Glossiness - second: 0.171 - - first: - name: _GlossyReflections - second: 1 - - first: - name: _Grid - second: 0 - - first: - name: _GridCamDist - second: 0.05091428 - - first: - name: _GridScale - second: 102.4 - - first: - name: _LightingMultiplier - second: 1.27 - - first: - name: _LowerScale - second: 42.982716 - - first: - name: _LowerScaleNormal - second: 42.982716 - - first: - name: _Metallic - second: 0 - - first: - name: _Mode - second: 0 - - first: - name: _OcclusionStrength - second: 1 - - first: - name: _Parallax - second: 0.02 - - first: - name: _Shininess - second: 0.03 - - first: - name: _Slope - second: 0 - - first: - name: _SmoothnessTextureChannel - second: 0 - - first: - name: _SpecularHighlights - second: 1 - - first: - name: _Splat0Scale - second: 170.66667 - - first: - name: _Splat0ScaleNormal - second: 72.57986 - - first: - name: _Splat1Scale - second: 74.285706 - - first: - name: _Splat1ScaleNormal - second: 40.36529 - - first: - name: _Splat2Scale - second: 92.52949 - - first: - name: _Splat2ScaleNormal - second: 92.52949 - - first: - name: _Splat3Scale - second: 99.902435 - - first: - name: _Splat3ScaleNormal - second: 99.902435 - - first: - name: _Splat4Scale - second: 99.902435 - - first: - name: _Splat4ScaleNormal - second: 40.460197 - - first: - name: _Splat5Scale - second: 136.9879 - - first: - name: _Splat5ScaleNormal - second: 29.028221 - - first: - name: _Splat6Scale - second: 256 - - first: - name: _Splat6ScaleNormal - second: 256 - - first: - name: _Splat7Scale - second: 23.153671 - - first: - name: _Splat7ScaleNormal - second: 23.153671 - - first: - name: _SrcBlend - second: 1 - - first: - name: _UVSec - second: 0 - - first: - name: _UpperScale - second: 50.514282 - - first: - name: _UpperScaleNormal - second: 1024 - - first: - name: _Water - second: 1 - - first: - name: _WaterLevel - second: 2 - - first: - name: _ZWrite - second: 1 - m_Colors: - - first: - name: _Abyss - second: {r: 0.005190316, g: 0.051962737, b: 0.2352941, a: 1} - - first: - name: _Color - second: {r: 0.15705165, g: 0.2205882, b: 0.10542818, a: 1} - - first: - name: _Deep - second: {r: 0.22577855, g: 0.4590157, b: 0.5294118, a: 1} - - first: - name: _EmissionColor - second: {r: 0, g: 0, b: 0, a: 1} - - first: - name: _ShadowColor - second: {r: 0.35, g: 0.35, b: 0.375, a: 1} - - first: - name: _SpecColor - second: {r: 0, g: 0, b: 0, a: 0} - - first: - name: _SunAmbience - second: {r: 0.2, g: 0.15, b: 0.1, a: 1} - - first: - name: _SunColor - second: {r: 0.65, g: 0.5, b: 0.4, a: 1} diff --git a/Assets/GFX/Terrain/TerrainShader.mat b/Assets/GFX/Terrain/TerrainShader.mat index f7a1dc09..a36c44aa 100644 --- a/Assets/GFX/Terrain/TerrainShader.mat +++ b/Assets/GFX/Terrain/TerrainShader.mat @@ -231,7 +231,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} m_Floats: - - _AbyssLevel: 0.3 + - _AbyssLevel: 0 - _Area: 1 - _AreaHeight: 128 - _AreaWidht: 204.8 @@ -242,11 +242,11 @@ Material: - _BrushUvX: 0.85578656 - _BrushUvY: 0.053629737 - _DeepLevel: 1.675625 - - _DepthLevel: 2 + - _DepthLevel: 1.1 - _GeneratingNormal: 0 - _Grid: 0 - _GridCamDist: 0.049673967 - - _GridScale: 51.2 + - _GridScale: 25.6 - _HideSplat0: 0 - _HideSplat1: 0 - _HideSplat2: 0 @@ -257,32 +257,32 @@ Material: - _HideSplat7: 0 - _HideSplat8: 0 - _LightingMultiplier: 1.27 - - _LowerScale: 128 - - _LowerScaleNormal: 58.514286 + - _LowerScale: 64 + - _LowerScaleNormal: 37.647057 - _Shininess: 0.03 - _Slope: 0 - - _Splat0Scale: 128 - - _Splat0ScaleNormal: 128 + - _Splat0Scale: 64 + - _Splat0ScaleNormal: 18.550724 - _Splat1Scale: 128 - _Splat1ScaleNormal: 128 - - _Splat2Scale: 128 - - _Splat2ScaleNormal: 128 - - _Splat3Scale: 128 - - _Splat3ScaleNormal: 128 - - _Splat4Scale: 128 - - _Splat4ScaleNormal: 128 - - _Splat5Scale: 128 - - _Splat5ScaleNormal: 128 - - _Splat6Scale: 128 - - _Splat6ScaleNormal: 128 - - _Splat7Scale: 128 - - _Splat7ScaleNormal: 128 + - _Splat2Scale: 42.666668 + - _Splat2ScaleNormal: 64 + - _Splat3Scale: 16.202532 + - _Splat3ScaleNormal: 8.677966 + - _Splat4Scale: 64 + - _Splat4ScaleNormal: 64 + - _Splat5Scale: 64 + - _Splat5ScaleNormal: 64 + - _Splat6Scale: 64 + - _Splat6ScaleNormal: 64 + - _Splat7Scale: 64 + - _Splat7ScaleNormal: 64 - _TTerrainXP: 0 - - _UpperScale: 4 - - _UpperScaleNormal: 512 + - _UpperScale: 2 + - _UpperScaleNormal: 256 - _UseSlopeTex: 1 - _Water: 1 - - _WaterLevel: 2.8 + - _WaterLevel: 1.33 - _WaterScaleX: 1024 - _WaterScaleZ: 1024 m_Colors: diff --git a/Assets/GFX/Terrain/WaterShader.mat b/Assets/GFX/Terrain/WaterShader.mat index bd602e53..0aa1f83e 100644 --- a/Assets/GFX/Terrain/WaterShader.mat +++ b/Assets/GFX/Terrain/WaterShader.mat @@ -104,7 +104,7 @@ Material: - _DetailNormalMapScale: 1 - _DstBlend: 0 - _Glossiness: 0.5 - - _GridScale: 51.2 + - _GridScale: 25.6 - _Metallic: 0 - _Mode: 0 - _OcclusionStrength: 1 @@ -118,5 +118,5 @@ Material: m_Colors: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - - sunColor: {r: 0.40637136, g: 0.2370499, b: 0.16932134, a: 1} - - waterColor: {r: 0, g: 0.35, b: 0.75, a: 1} + - sunColor: {r: 0.4063715, g: 0.23705, b: 0.1693215, a: 1} + - waterColor: {r: 0.64, g: 0.34, b: 0.175, a: 1} diff --git a/Assets/MapEditor.unity b/Assets/MapEditor.unity index f0d97db3..231d2763 100644 --- a/Assets/MapEditor.unity +++ b/Assets/MapEditor.unity @@ -24538,6 +24538,11 @@ Prefab: propertyPath: m_Text value: Initial height objectReference: {fileID: 0} + - target: {fileID: 114549324857000576, guid: 048a57cfe4940574d8af5c3937d7c028, + type: 2} + propertyPath: BeginValue + value: 16 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 048a57cfe4940574d8af5c3937d7c028, type: 2} m_IsPrefabParent: 0 @@ -36000,7 +36005,7 @@ Camera: serializedVersion: 2 m_Bits: 2560 m_RenderingPath: 1 - m_TargetTexture: {fileID: 1306081321} + m_TargetTexture: {fileID: 1538731108} m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 0 @@ -51721,7 +51726,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Sup Com Forged Alliance instalation path + m_Text: Sup Com Forged Alliance installation path --- !u!222 &786803106 CanvasRenderer: m_ObjectHideFlags: 0 @@ -75902,10 +75907,10 @@ GameObject: m_Component: - component: {fileID: 1168910113} - component: {fileID: 1168910112} - - component: {fileID: 1168910114} - component: {fileID: 1168910116} - component: {fileID: 1168910115} - m_Layer: 0 + - component: {fileID: 1168910114} + m_Layer: 8 m_Name: Preview m_TagString: Untagged m_Icon: {fileID: 0} @@ -75920,7 +75925,7 @@ Camera: m_GameObject: {fileID: 1168910111} m_Enabled: 0 serializedVersion: 2 - m_ClearFlags: 2 + m_ClearFlags: 3 m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} m_NormalizedViewPortRect: serializedVersion: 2 @@ -75930,13 +75935,13 @@ Camera: height: 1 near clip plane: 0.3 far clip plane: 1000 - field of view: 35 + field of view: 20 orthographic: 0 orthographic size: 5 m_Depth: 0 m_CullingMask: serializedVersion: 2 - m_Bits: 17680 + m_Bits: 17681 m_RenderingPath: 3 m_TargetTexture: {fileID: 8400000, guid: 3fffb8677da01ab4898dcc3e0fad9195, type: 2} m_TargetDisplay: 0 @@ -75974,6 +75979,7 @@ MonoBehaviour: m_EditorClassIdentifier: Cam: {fileID: 1168910112} RT: {fileID: 8400000, guid: 3fffb8677da01ab4898dcc3e0fad9195, type: 2} + Empty: {r: 0.078431375, g: 0.078431375, b: 0.078431375, a: 1} --- !u!114 &1168910115 MonoBehaviour: m_ObjectHideFlags: 0 @@ -75987,7 +75993,7 @@ MonoBehaviour: m_EditorClassIdentifier: threshold: 0 intensity: 0.75 - blurSize: 1 + blurSize: 0.55 blurIterations: 1 blurType: 0 fastBloomShader: {fileID: 4800000, guid: 68a00c837b82e4c6d92e7da765dc5f1d, type: 3} @@ -75997,7 +76003,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1168910111} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 646b5bc27a658f447b1d929fd5ffbd70, type: 3} m_Name: @@ -85050,37 +85056,6 @@ RectTransform: m_AnchoredPosition: {x: 292.3, y: -39.24999} m_SizeDelta: {x: 262, y: 30} m_Pivot: {x: 0, y: 1} ---- !u!84 &1306081321 -RenderTexture: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: - m_ImageContentsHash: - serializedVersion: 2 - Hash: 00000000000000000000000000000000 - m_ForcedFallbackFormat: 4 - m_DownscaleFallback: 0 - m_Width: 256 - m_Height: 256 - m_AntiAliasing: 1 - m_DepthFormat: 1 - m_ColorFormat: 0 - m_MipMap: 0 - m_GenerateMips: 1 - m_SRGB: 0 - m_UseDynamicScale: 0 - m_BindMS: 0 - m_TextureSettings: - serializedVersion: 2 - m_FilterMode: 1 - m_Aniso: 0 - m_MipBias: 0 - m_WrapU: 1 - m_WrapV: 1 - m_WrapW: 1 - m_Dimension: 2 - m_VolumeDepth: 1 --- !u!1 &1307749638 GameObject: m_ObjectHideFlags: 0 @@ -87087,32 +87062,59 @@ MonoBehaviour: UncompressedNormalmapTex: {fileID: 0} DefaultSkyboxData: Position: {x: 256, y: 0, z: 256} - Scale: {x: -35.45, y: 1171.581, z: 1256637} + Scale: {x: -42.5, y: 2343.163, z: 1.256637} SubdivisionsAxis: 16 SubdivisionsHeight: 6 - Value3: 174.5082 - HorizoColor: {r: 0, g: 0, b: 0, a: 0} - ZenithColor: {r: 0, g: 0, b: 0, a: 0} + Value3: 293.5071 + HorizoColor: {r: 0.64705884, g: 0.8196079, b: 0.83921576, a: 0} + ZenithColor: {r: 0.21960786, g: 0.41176474, b: 0.72156864, a: 0} Value6: 0.1 Albedo: /textures/environment/Decal_test_Albedo003.dds Glow: /textures/environment/Decal_test_Glow003.dds - Planets: [] + Planets: + - Position: {x: 2190.581, y: 570.7427, z: -1020.003} + Scale: {x: -1.584759, y: 183, z: 183} + Uv: {x: 0, y: 0.5, z: 0.5, w: 0.5} + - Position: {x: 2759.316, y: 206.2788, z: -118.4224} + Scale: {x: -1.757547, y: 55, z: 55} + Uv: {x: 0, y: 0.5, z: 0.5, w: 0.5} + - Position: {x: 2756.078, y: 646.0668, z: 319.3271} + Scale: {x: 0, y: 22, z: 22} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} + - Position: {x: 1821.547, y: 802.5594, z: 2281.576} + Scale: {x: 0, y: 15, z: 15} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} + - Position: {x: 2780.865, y: 583.7109, z: 467.8984} + Scale: {x: 0, y: 10, z: 10} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} + - Position: {x: 2812.305, y: 423.0659, z: 370.4955} + Scale: {x: 0, y: 7, z: 7} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} + - Position: {x: -1591.351, y: 318.7024, z: 1494.22} + Scale: {x: 0, y: 40, z: 40} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} + - Position: {x: -992.0874, y: 463.4517, z: -1223.899} + Scale: {x: 0, y: 18, z: 18} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} + - Position: {x: -677.46, y: 261.3729, z: -1489.819} + Scale: {x: 0, y: 10, z: 10} + Uv: {x: 0.5, y: 0, z: 0.5, w: 0.5} MidRgbColor: serializedVersion: 2 rgba: 0 Mid0: 1.8 - Mid1: 0.97 - Mid2: 0.97 - Mid3: 0.97 + Mid1: 1.16 + Mid2: 1.16 + Mid3: 1.23 Clouds: /textures/environment/cirrus000.dds CloudsInt: 4 - Clouds1: {x: 0, y: 0, z: 0} - Clouds2: {x: 0, y: 0, z: 0} - Clouds3: {x: 0, y: 0, z: 0} - Clouds4: {x: 0, y: 0, z: 0} - Clouds5: {x: 0, y: 0, z: 0} - Clouds6: {x: 0, y: 0, z: 0} - Clouds7: {x: 0, y: 0, z: 0} + Clouds1: {x: 0.0001, y: 0.0001, z: 7.8} + Clouds2: {x: 0.4320857, y: -0.9018325, z: 0.0010108} + Clouds3: {x: 0.0031888, y: 1.28, z: 1} + Clouds4: {x: 0, y: 0.0006445, z: 0.0010108} + Clouds5: {x: 0, y: 0.9499721, z: 0.3123349} + Clouds6: {x: 0.003367, y: 0.0059113, z: 0.55} + Clouds7: {x: 0.9995599, y: 0.02966619, z: 0} Slope: 0 --- !u!114 &1334852569 MonoBehaviour: @@ -100479,6 +100481,37 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1537465954} +--- !u!84 &1538731108 +RenderTexture: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + m_Width: 256 + m_Height: 256 + m_AntiAliasing: 1 + m_DepthFormat: 1 + m_ColorFormat: 0 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 --- !u!1 &1539974756 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs b/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs index a51356aa..2b935503 100644 --- a/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs +++ b/Assets/Scripts/Ozone SCMAP Code/ScmapEditor.cs @@ -84,7 +84,7 @@ public void UpdateLighting() PostProcessing.bloom.settings = Bs; BloomOpt.intensity = map.Bloom; - BloomOptPreview.intensity = map.Bloom; + BloomOptPreview.intensity = map.Bloom * 2; RenderSettings.fogColor = new Color(map.FogColor.x, map.FogColor.y, map.FogColor.z, 1); RenderSettings.fogStartDistance = map.FogStart * 2; @@ -575,24 +575,51 @@ public void UpdateScales(int id) #region Saving public void SaveScmapFile() { + float LowestElevation = 128; + float HighestElevation = 0; + if (Teren) { heights = Teren.terrainData.GetHeights(0, 0, Teren.terrainData.heightmapWidth, Teren.terrainData.heightmapHeight); float HeightResize = 512 * 40; - for (int y = 0; y < map.Width + 1; y++) + int y = 0; + int x = 0; + for (y = 0; y < map.Width + 1; y++) { - for (int x = 0; x < map.Height + 1; x++) + for (x = 0; x < map.Height + 1; x++) { - map.SetHeight(y, map.Height - x, (short)(heights[x, y] * HeightResize)); + float Height = heights[x, y]; + + LowestElevation = Mathf.Min(LowestElevation, Height); + HighestElevation = Mathf.Max(HighestElevation, Height); + + map.SetHeight(y, map.Height - x, (short)(Height * HeightResize)); } } } + LowestElevation = (LowestElevation * 16) / 0.1f; + if (map.Water.HasWater) + LowestElevation = Mathf.Max(LowestElevation, map.Water.Elevation); + + HighestElevation = (HighestElevation * 16) / 0.1f; + if (MapLuaParser.Current.EditMenu.MapInfoMenu.SaveAsFa.isOn) { + if(map.AdditionalSkyboxData.Data.Position.x == 0) + { + map.AdditionalSkyboxData.Data.CopyFrom(DefaultSkyboxData); + } + map.VersionMinor = 60; + map.AdditionalSkyboxData.Data.Position = WorldPosToScmap(MapLuaParser.Current.MapCenterPoint); + + + map.AdditionalSkyboxData.Data.Position.y = Mathf.Clamp(LowestElevation - 1, 0, 128); + map.AdditionalSkyboxData.Data.Scale.y = Mathf.Max(map.Width, map.Height) * 2.288245f; + } else if(map.VersionMinor >= 60) { @@ -632,8 +659,7 @@ public void SaveScmapFile() map.NormalmapTex.Compress(true); map.NormalmapTex.Apply(); - map.PreviewTex = PreviewRenderer.RenderPreview(); - + map.PreviewTex = PreviewRenderer.RenderPreview(((LowestElevation + HighestElevation) / 2) * 0.1f); for (int i = 0; i < map.Layers.Count; i++) diff --git a/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs b/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs index 0bd08cca..5154f043 100644 --- a/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs +++ b/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs @@ -6,23 +6,39 @@ public class PreviewTex : MonoBehaviour { public Camera Cam; public RenderTexture RT; + public Color Empty; - public Texture2D RenderPreview() { + public Texture2D RenderPreview(float HeightOffset = 0) { Vector3 CamPos = MapLuaParser.Current.MapCenterPoint; float Size = Mathf.Max(ScmapEditor.Current.map.Width, ScmapEditor.Current.map.Height) * 0.1f; float distance = Size * (2.0f * Mathf.Tan(0.5f * Cam.fieldOfView * Mathf.Deg2Rad)); - CamPos.y = distance * 2; + + distance = (Size) * 0.5f / Mathf.Tan(Cam.fieldOfView * 0.5f * Mathf.Deg2Rad); + + CamPos.y = distance + HeightOffset; transform.position = CamPos; - Cam.Render(); + RenderTexture currentActiveRT = RenderTexture.active; + RenderTexture.active = Cam.targetTexture; - RenderTexture.active = RT; + float LastLodBias = QualitySettings.lodBias; + QualitySettings.lodBias = 100000; + Cam.Render(); + QualitySettings.lodBias = LastLodBias; Texture2D PreviewRender = new Texture2D(256, 256, TextureFormat.RGBA32, false); - PreviewRender.ReadPixels(new Rect(0, 0, PreviewRender.width, PreviewRender.height), 0, 0); + + Color[] Colors = new Color[256 * 256]; + for(int i = 0; i < Colors.Length; i++) + { + Colors[i] = Empty; + } + PreviewRender.SetPixels(Colors); + PreviewRender.Apply(); + PreviewRender.ReadPixels(new Rect(0, 0, PreviewRender.width, PreviewRender.height), 0, 0, false); PreviewRender.Apply(); //Texture2D Preview = TextureLoader.ConvertToBGRA(PreviewRender); @@ -38,4 +54,5 @@ public Texture2D RenderPreview() { } + } diff --git a/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTexture.renderTexture b/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTexture.renderTexture index e1b6fd24..896d7ed2 100644 --- a/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTexture.renderTexture +++ b/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTexture.renderTexture @@ -14,11 +14,11 @@ RenderTexture: m_Width: 256 m_Height: 256 m_AntiAliasing: 1 - m_DepthFormat: 1 + m_DepthFormat: 2 m_ColorFormat: 0 m_MipMap: 0 m_GenerateMips: 1 - m_SRGB: 0 + m_SRGB: 1 m_UseDynamicScale: 0 m_BindMS: 0 m_TextureSettings: diff --git a/Assets/Scripts/UI/Tools/NewMap.cs b/Assets/Scripts/UI/Tools/NewMap.cs index 07e4485e..08c55e5f 100644 --- a/Assets/Scripts/UI/Tools/NewMap.cs +++ b/Assets/Scripts/UI/Tools/NewMap.cs @@ -36,7 +36,7 @@ public void Clean() MapType.value = 0; Width.value = 3; Height.value = 3; - InitialHeight.SetValue(64); + InitialHeight.SetValue(16); } public void ToggleWater() diff --git a/FAForeverMapEditor.Editor.Plugins.csproj b/FAForeverMapEditor.Editor.Plugins.csproj index 987de9d1..74563f9d 100644 --- a/FAForeverMapEditor.Editor.Plugins.csproj +++ b/FAForeverMapEditor.Editor.Plugins.csproj @@ -317,11 +317,15 @@ - + + + + + @@ -374,10 +378,6 @@ - - - - diff --git a/FAForeverMapEditor.Editor.csproj b/FAForeverMapEditor.Editor.csproj index 962f90d0..64a3718d 100644 --- a/FAForeverMapEditor.Editor.csproj +++ b/FAForeverMapEditor.Editor.csproj @@ -342,11 +342,15 @@ - + + + + + @@ -399,10 +403,6 @@ - - - - diff --git a/FAForeverMapEditor.Plugins.csproj b/FAForeverMapEditor.Plugins.csproj index 262b6741..ebb73ac6 100644 --- a/FAForeverMapEditor.Plugins.csproj +++ b/FAForeverMapEditor.Plugins.csproj @@ -331,11 +331,15 @@ - + + + + + @@ -388,10 +392,6 @@ - - - - diff --git a/FAForeverMapEditor.csproj b/FAForeverMapEditor.csproj index 8c8f867b..5a296c92 100644 --- a/FAForeverMapEditor.csproj +++ b/FAForeverMapEditor.csproj @@ -606,11 +606,15 @@ - + + + + + @@ -663,10 +667,6 @@ - - - -