Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RenderTexture texture = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.ARGB32)
- {
- wrapMode = TextureWrapMode.Repeat
- };
- for (int i = 0; i < _textureLayers.Length; i++)
- {
- TextureLayer layer = _textureLayers[i];
- Texture2D srcTexture = new Texture2D(resolution, resolution, TextureFormat.ARGB32, false, true)
- {
- alphaIsTransparency = true
- };
- srcTexture.Apply();
- _materialBlit.SetTexture("_MainTexture", layer.texture);
- _materialBlit.SetTextureScale("_MainTexture", new Vector2(layer.textureTile.x, layer.textureTile.y));
- _materialBlit.SetTextureOffset("_MainTexture", new Vector2(layer.textureTile.z, layer.textureTile.w));
- _materialBlit.SetTexture("_NoiseMap", _textureLayers[i].noise);
- _materialBlit.SetTextureScale("_NoiseMap", new Vector2(layer.noiseTile.x, layer.noiseTile.y));
- _materialBlit.SetTextureOffset("_NoiseMap", new Vector2(layer.noiseTile.z, layer.noiseTile.w));
- _materialBlit.SetVector("_Smoothstep", _textureLayers[i].smoothstep);
- //_materialBlit.SetVector("_Elevation", _textureLayers[i].elevation);
- RenderTexture dstTexture = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.ARGB32)
- {
- wrapMode = TextureWrapMode.Repeat
- };
- Graphics.Blit(srcTexture, dstTexture, _materialBlit);
- Graphics.CopyTexture(dstTexture, texture);
- }
- _material.SetTexture("_MainTexture", texture);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement