// Border generation private void OnRenderImage(RenderTexture src, RenderTexture dest) { MapMaterial.SetBuffer(ProvColorBuffer, _provLookup); // Passing which border to render. MapMaterial.SetFloat(CountryBorderToggle, _orthographicSize > 1.5f ? 0 : 1); var terrainTemp = RenderTexture.GetTemporary(src.descriptor); var oceanTemp = RenderTexture.GetTemporary(src.descriptor); // Province coloring. Graphics.Blit(src, terrainTemp, MapMaterial); // Overlay combination. F**k Unity. // Terrain BlendMaterial.SetTexture(SecondTex, TerrainTexture); BlendMaterial.SetFloat(SkipDirection, 1); BlendMaterial.SetFloat(BlendStrength, 0.5f); Graphics.Blit(terrainTemp, oceanTemp, BlendMaterial); // Ocean BlendMaterial.SetTexture(SecondTex, OceanTexture); BlendMaterial.SetFloat(SkipDirection, 0); BlendMaterial.SetFloat(BlendStrength, 0.75f); Graphics.Blit(oceanTemp, dest, BlendMaterial); terrainTemp.Release(); oceanTemp.Release(); }
// lerps between previous and next weather texture IEnumerator LerpWeatherTexture() { isChangingWeather = true; for (float t = 0f; t <= blendTime; t += Time.deltaTime * (clouds.globalMultiplier == 0.0 ? blendTime : Mathf.Abs(clouds.globalMultiplier))) { BlendMaterial.SetTexture("_PrevWeather", prevWeatherTexture); BlendMaterial.SetTexture("_NextWeather", nextWeatherTexture); BlendMaterial.SetFloat("_Alpha", t / blendTime); Graphics.Blit(null, rt, BlendMaterial, 0); setWeatherTexture(); yield return(null); } Graphics.Blit(nextWeatherTexture, rt); setWeatherTexture(); isChangingWeather = false; }