Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.75 KB | None | 0 0
  1.             RenderTexture texture = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.ARGB32)
  2.             {
  3.                 wrapMode = TextureWrapMode.Repeat
  4.             };
  5.  
  6.             for (int i = 0; i < _textureLayers.Length; i++)
  7.             {
  8.                 TextureLayer layer = _textureLayers[i];
  9.  
  10.                 Texture2D srcTexture = new Texture2D(resolution, resolution, TextureFormat.ARGB32, false, true)
  11.                 {
  12.                     alphaIsTransparency = true
  13.                 };
  14.                 srcTexture.Apply();
  15.  
  16.                 _materialBlit.SetTexture("_MainTexture", layer.texture);
  17.                 _materialBlit.SetTextureScale("_MainTexture", new Vector2(layer.textureTile.x, layer.textureTile.y));
  18.                 _materialBlit.SetTextureOffset("_MainTexture", new Vector2(layer.textureTile.z, layer.textureTile.w));
  19.  
  20.                 _materialBlit.SetTexture("_NoiseMap", _textureLayers[i].noise);
  21.                 _materialBlit.SetTextureScale("_NoiseMap", new Vector2(layer.noiseTile.x, layer.noiseTile.y));
  22.                 _materialBlit.SetTextureOffset("_NoiseMap", new Vector2(layer.noiseTile.z, layer.noiseTile.w));
  23.  
  24.                 _materialBlit.SetVector("_Smoothstep", _textureLayers[i].smoothstep);
  25.  
  26.                 //_materialBlit.SetVector("_Elevation", _textureLayers[i].elevation);
  27.  
  28.                 RenderTexture dstTexture = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.ARGB32)
  29.                 {
  30.                     wrapMode = TextureWrapMode.Repeat
  31.                 };
  32.  
  33.                 Graphics.Blit(srcTexture, dstTexture, _materialBlit);
  34.  
  35.                 Graphics.CopyTexture(dstTexture, texture);
  36.             }
  37.             _material.SetTexture("_MainTexture", texture);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement