Search Unity

About Unity's Terrain System Tile Painting

Discussion in 'Scripting' started by ptr0x, Apr 15, 2015.

  1. ptr0x

    ptr0x

    Joined:
    Dec 9, 2013
    Posts:
    54
    Hello, I'm having serious problems with the Unity native terrain system. I will describe my situation bellow.

    I have to be able to read some binary files and set the height of the terrain according to the data on those binary files. Until here Unity's native system serves me well.
    The problem came when I needed to work with splat textures. Apparently the Unity's terrain system creates one new alpha layer for every splat texture added to the terrain. I really can't work with this. My game has already 196 tile textures, each tile is 2x2 and the complete map of the game is 4096x4096, so if you do the maths, Unity ends up allocating a lot of unecessary RAM (which ends up not working at all: from the splat 10 to the end (196) it just paints a black square when I try to paint via script or via Inspector window and throw some error about don't being able to create the Undo object due to the size of the buffer is too high). The key point is that I do not need 196 layers for every 2x2, the worst case scenario I would need to merge only 2 textures, not 196. Unity ends up allocating 2048x2048x196 splats and layers. I searched about and apparently I can't set the maximum number of layers. When I add the textures to the Unity's terrain via script, the Unity process in Windows eats something about 4gb of RAM.

    So, I'm very concerned about this because the terrain being painted with these 196 texture tiles is mandatory in the project.

    If anyone have any idea that could help me, please let me know.

    Thank you very much.
     
  2. ptr0x

    ptr0x

    Joined:
    Dec 9, 2013
    Posts:
    54
    up =[