Adjust shores

This commit is contained in:
Nahuel Rocchetti 2023-07-27 20:43:58 -03:00
parent 28951e769b
commit 159df4d1ac
2 changed files with 6 additions and 4 deletions

View file

@ -75,7 +75,7 @@ namespace OpenTS2.Scenes
var vars1 = GetVariationRectangles(terrainAsset.Width, terrainAsset.Height);
var vars2 = GetVariationRectangles(terrainAsset.Width, terrainAsset.Height);
MakeVariationVertexColors(terrainMesh, vars1, vars2);
MakeVertexColors(terrainMesh, vars1, vars2);
LightmapManager.RenderShadowMap();
meshRenderer.material.SetTexture("_ShadowMap", LightmapManager.ShadowMap);
meshRenderer.material.SetTexture("_ShoreMask", LightmapManager.ShoreMap);
@ -108,8 +108,9 @@ namespace OpenTS2.Scenes
terrainMesh.colors = cols;
}
void MakeVariationVertexColors(Mesh terrainMesh, List<Rect> variations1, List<Rect> variations2)
void MakeVertexColors(Mesh terrainMesh, List<Rect> variations1, List<Rect> variations2)
{
var seaLevel = NeighborhoodManager.CurrentNeighborhood.Terrain.SeaLevel;
var vertices = terrainMesh.vertices;
var colors = terrainMesh.colors;
for(var i=0;i<vertices.Length;i++)

View file

@ -92,7 +92,8 @@ Shader "OpenTS2/ClassicTerrain"
o.cliff = max(0,min(1,pow(-(dot(worldNormal, float3(0.0, 1.0, 0.0)) - 1), 2) * 3));
o.shadowUv = float2(v.vertex.x, v.vertex.z) / (128 * 10);
o.height = v.vertex.y;
if (v.vertex.y <= _SeaLevel)
o.color.b = 1;
return o;
}
@ -109,7 +110,7 @@ Shader "OpenTS2/ClassicTerrain"
fixed4 shadowMapCol = tex2D(_ShadowMap, i.shadowUv);
i.matcapUv *= shadowMapCol.r;
float shoreAmount = min(1,tex2D(_ShoreMask, i.shadowUv) * 1.1);
float shoreAmount = min(1,tex2D(_ShoreMask, i.shadowUv) * 1.1 + i.color.b);
fixed4 shoreCol = tex2D(_Shore, i.uv);