Quantcast
Channel: Latest Questions by User Banned
Viewing all articles
Browse latest Browse all 10

Terrain artifacts after binary serialization

$
0
0
Hi, Im working towards serialising my Terrain, and from what I can gather I have to create a byte[] out of Getheights and then convert it back to Setheights to reimplement. When testing a basic implementation of that process I run into many artefacts and much unpleasantness. Im fairly sure its something to do with the way im reimplementing the byte[] into Setheights, as altering the division value changes the amplitude of the distortion, however ive hit a wall with how to resolve the situation. Any help would be greatly appreciated. An example of the distortion: Happy ![alt text][1] Not happy. ![alt text][2] using UnityEngine; using System.Collections; public class terrainSTATE : MonoBehaviour { public bool getdat; public bool setdat; byte[] Bytes; void Update () { if (getdat) { GetData (); } if (setdat) { SetData (); } } void GetData () { TerrainData TD = GetComponent ().terrainData; float[,] heights = TD.GetHeights (0, 0, 512, 512); Bytes = new byte[263169]; int i = 0; for (int x = 0; x ().terrainData; int heightmapWidth = TD.heightmapWidth; int heightmapHeight = TD.heightmapHeight; float[,] heightmap = new float[heightmapWidth, heightmapHeight]; int i = 0; for (int x = 0; x

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images