Tiny Terrain

Documentation for Tiny Terrain v1.0

Introduction

Thanks for using Tiny Terrain! Don't forget to leave a review on the store page if you liked it, this helps us a lot! https://assetstore.unity.com/packages/slug/236464

Description

Tiny Terrain is a lossy Terrain Data compression technology for Unity Terrain Engine, which allows you to reduce the size of the data that Terrain takes in the project many times and significantly reduce the size of your application.

You pay a little CPU time and additional memory usage, but save tens and hundreds of megabytes for each Terrain in the project.

Even though the compression is lossy, in most cases you won't see any visual difference at all.

A very high compression ratio is achieved due to the author's data preparation algorithms and then compression using Brotli.

Even if your build or AssetBundle is already compressed using LZ4, LZ4HC or LZMA, Tiny Terrain will be able to reduce its size. Of course the difference in size won't be as huge as with the uncompressed data, but it's still pretty big.

Tiny Terrain is not a 3rd party Terrain Engine, and you can use Unity Terrain API and any terrain tools you like, such as Real World Terrain, Gaia, Vegetation Studio, etc.

Quick Start

Select Terrain in the scene, add Tiny Terrain Loader component, change the compression settings if necessary, and click Compress. Wait for Terrain compression to complete.

After compression, three files are created next to the original terrain file: [TERRAIN_NAME].tinyterrain.asset - Contains compressed data. [TERRAIN_NAME].tinyterraininfo.asset - Contains compression information. Not included in the build. [TERRAIN_NAME].runtime.tinyterrain.asset - An empty Terrain Data with minimal settings into which the data will be decompressed. Present to work around a Unity bug that causes the wrong grass shader to be used for dynamic Terrain Data.

The compressed Terrain will be automatically loaded and displayed in the scene instead of the original one.

Tiny Terrain Loader

Tiny Terrain Loader component compresses and decompresses a single Terrain.

When no compressed data is selected, the component will look like this: Tiny Terrain Loader Original

Tiny Terrain Data - compressed data to be used. If you select a value, it will be loaded into the current Terrain. If you select None, the original Terrain will be restored. Heighmap Accuracy - The number of bits used to store the heightmap value. Alphamap Accuracy - The number of bits used to store the alphamap value. Compression Mode - Tiny Terrain can compress data in main or separate threads. Compress - Compresses the current Terrain. Restore Previous Compression - Present if the Terrain has already been compressed. Allows the previous compression state to be used.

After Terrain is compressed it will look like this: Tiny Terrain Loader Compressed

Decompression Time - How many seconds was the last decompression, including how long the Unity API took to set values for Terrain. Will update every time the Terrain is loaded.

Decompression Mode - Tiny Terrain can decompress in the following modes:

Compressed Size - The total size of the compressed data in bytes.

Compression Time - How many seconds did the compression take.

Saved Space - Reducing the size of compressed data compared to uncompressed ones. Hover over the progress bar for more information. You can expand the progress bar to see how much space is saved for each Terrain element.

On Load Complete - Event called when the Terrain is loaded.

On Progress Changed - Event called when Terrain loading progress has been changed. Important: Use the method in the Dynamic section. Otherwise, you will always have the value specified in the inspector.

Restore Original Terrain - Restores the original Terrain. Use if you want to change Terrain or compression settings.

Convert to Bulk Loader - Moves Terrain load to Bulk Tiny Terrain Loader and removes the current component. If Bulk Tiny Terrain Loader is not present, creates it.

Bulk Tiny Terrain Loader

Bulk Tiny Terrain Loader compresses and decompresses multiple terrains.

Bulk Tiny Terrain Loader

Decompression Mode - Tiny Terrain can decompress in the following modes:

Items - List of Terrains to load.

On Load Complete - Event called when Terrains is loaded.

On Progress Changed - Event called when loading progress has been changed. Important: Use the method in the Dynamic section. Otherwise, you will always have the value specified in the inspector.

Heighmap Accuracy - The number of bits used to store the heightmap value.

Alphamap Accuracy - The number of bits used to store the alphamap value.

Compression Mode - Tiny Terrain can compress data in main or separate threads.

Compress All Child Terrains - Compresses all child Terrains.

Compression Algorithm

Tiny Terrain prepares Terrain Data map data and compresses it using Brotli.

Brotli has a very high compression ratio close to LZMA, fast decompression and very good support in the industry.

The downside of Brotli is the slow compression speed, which doesn't matter in this case because you only need to compress Terrain once in the editor.

Note: Trees are not compressed with Brotli. Tiny Terrain removes unused parts of the data, reduces data precision where possible, and only uses 12 bytes per tree.

After compression, three files are created next to the original terrain file: [TERRAIN_NAME].tinyterrain.asset - Contains compressed data. [TERRAIN_NAME].tinyterraininfo.asset - Contains compression information. Not included in the build. [TERRAIN_NAME].runtime.tinyterrain.asset - An empty Terrain Data with minimal settings into which the data will be decompressed. Present to work around a Unity bug that causes the wrong grass shader to be used for dynamic Terrain Data.

Compression Ratio

Heightmap. Unity Terrain Engine stores a heightmap of 2 bytes per value. Tiny Terrain compresses this from 2:1 to 20:1 lossless or lossy.

Alphamap. Unity Terrain Engine stores an alphamap in ARGB8 UNorm textures. Tiny Terrain compresses this from 5:1 to 50:1 of its original size lossless or lossy.

Detailmap. Unfortunately, I don't have exact information on how Unity Terrain Engine stores the detailmap, but my observations is that it uses 1 bytes per value. Tiny Terrain compresses this from 5:1 to 50:1 lossless.

Trees. Unity Terrain Engine stores trees 36 bytes per tree. Tiny Terrain removes unused parts of the data, reduces data precision where possible, and only uses 12 bytes per tree, resulting in 3:1 compression ratio.

Holes. Unity Terrain Engine stores holes of 1 byte per value, which adds over 4 MB when used. This is very wasteful. Tiny Terrain compresses holes from 1000:1 to 10000:1 lossless, making them almost weightless. In most cases, the holemap will be less than 1 KB in size.

On average, in real projects, you can expect an overall compression ratio of 3:1 to 50:1 with no visible difference, and up to 100:1 with visible quality loss.

API

Tiny Terrain has an API for compressing, decompressing and loading Terrain.

You can read more about the description of fields, properties and methods in the API Reference:

https://infinity-code.com/doxygen/tiny-terrain/index.html

Updating Asset

We send to Unity Asset Store only stable versions.

Tiny Terrain has a built-in update system, using which you can download the latest versions of Tiny Terrain and get early access to all versions and updates.

Important: Always back up the project before updating assets.

Select "Tiny Terrain Loader / Help / Check Updates", to open the updater window. Enter your Invoice Number or Order Number, select the update channel and click "Check New Versions".

You can find your Invoice Number in Unity Asset Store order confirmation email, or on the orders page in Unity Asset Store: https://assetstore.unity.com/orders

If more than 10 updates were released in the selected channel from the current version, only the last 10 updates will be shown.

If updates are available, you can read the list of changes and download the update.

If you have problems installing the update, then:

  1. Remove "Plugins / Infinity Code / Tiny Terrain" folder.
  2. Import the new version of Tiny Terrain into the project.

If you want to return to the previous version of Tiny Terrain, then select the channel "Stable Previous". Using this channel, you can get 10 previous stable versions.

Tiny Terrain automatically checks for updates every 24 hours. If the new version is available, you will see an icon in the Actions. Clicking on this action will open the updater window.

Automatic update check does not require an Invoice Number, and works on a previously selected update channel. If you did not select the update channel, then only stable versions will be checked.

Troubleshooting

Known Issues

Grass is rotated relative to its original Terrain orientation Unity Terrain Engine does not support grass rotation. This is a bug in Unity Terrain Engine displaying grass in dynamic Terrain Data. Waiting for a fix from Unity.

Your problem is not listed

Try to update to the latest version of the asset, using the built-in update system. Perhaps we have already fixed this problem.

If the problem persists, please contact us about this problem using email (support@infinity-code.com), forum (http://forum.infinity-code.com) or discord (https://discord.gg/2XRWwPgZK4). We will try to fix all bugs and release the update as soon as possible.

Support

We provide support using email (support@infinity-code.com) in English and Russian, using forum (https://forum.infinity-code.com) or discord (https://discord.gg/2XRWwPgZK4) in English.

If something does not work for you, you have found a bug, or you have a suggestion, please contact to us. When contacting, please specify your OS, the version of Unity Editor and the version of Tiny Terrain. We try to respond to all request to the support within 24 hours.

Other Infinity Code assets

Huge Texture

Huge Texture

https://assetstore.unity.com/packages/tools/input-management/huge-texture-163576

Huge Texture allows you to import and use textures larger than 8192x8192px.

How it works: When importing a texture, Huge Texture splits the texture into pages and saves it as a Texture Array. Texture Array is combined on the shader side, which does not create extra draw calls and has almost no effect on performance.

Features:

Requirements:

Mesh to Terrain

Mesh to Terrain

https://assetstore.unity.com/packages/tools/terrain/mesh-to-terrain-7271

Mesh to Terrain is a tool for easily and quickly converting a 3D terrain model created in 3ds Max, Terragen or any other editor to Unity Terrains. Mesh to Terrain can convert textures to SplatPrototypes (Terrain Layers), generate terrain from several models and split the model into several terrains.

Features:

Online Maps

Online Maps

https://assetstore.unity.com/packages/tools/integration/online-maps-v3-138509

Online Maps is a universal multi-platform mapping solution for your 2D, 3D, AR / VR and mobile applications and games. Fully customizable, incredibly easy to learn and use, and at the same time is one of the most powerful and flexible solutions in the industry. Supports a huge number of services for any mapping needs, and has integration with the best Asset Store assets. The package contains the complete source code without dependencies, and if you want to add or change some feature, you can easily do it. Don't have programming experience or don't know C# - Online Maps supports visual scripting using Bolt and Playmaker. All the features to create any map in Unity in one asset.

Features:

Real World Terrain

Real World Terrain

https://assetstore.unity.com/packages/tools/terrain/real-world-terrain-8752

Real World Terrain is a tool for automatically creating high-quality terrains, meshes, Gaia stamps and RAW files based on real-world data with global coverage. Incredibly fast and easy to use, and allows you to create high-quality terrains in a couple of clicks. In addition, Real World Terrain can create buildings, roads, trees, grass, and rivers based on Open Street Map data. Real World Terrain is incredibly powerful and flexible. It has a powerful Editor API to automate the generation of terrains, and Runtime API positioning objects by coordinates, etc. Real World Terrain has integration with the best assets of the Asset Store, which gives almost unlimited possibilities in the generation of terrains.

Features:

Terrain Quality Manager

Terrain Quality Manager

https://assetstore.unity.com/packages/tools/terrain/terrain-quality-manager-28949

Terrain Quality Manager allows you to change the resolution of Heightmap, Detailmap, Alphamap and Basemap, without losing data. If you need to increase the quality of terrain, or optimize terrain for better performance, with this tool you can do it.

Features:

Tree Tool