public Texture3D CreateWorldTexture() { // Configure the texture int sizeX = (int)(terrainManager.maxChunks.x * terrainManager.terrainGenerator.chunkSize.x); int sizeY = (int)(terrainManager.maxChunks.y * terrainManager.terrainGenerator.chunkSize.y); int sizeZ = (int)(terrainManager.maxChunks.z * terrainManager.terrainGenerator.chunkSize.z); TextureFormat format = TextureFormat.R16; TextureWrapMode wrapMode = TextureWrapMode.Clamp; // Create the texture and apply the configuration Texture3D texture = new Texture3D(sizeX, sizeY, sizeZ, format, false); texture.wrapMode = wrapMode; texture.filterMode = FilterMode.Point; // get data ushort[] values = terrainManager.GenerateChunkData(); // set data and return texture.SetPixelData(values, 0, 0); texture.Apply(); return(texture); }