With help of computer simulators and other training interactive 3D applications in today's world you can get a large amount of practical knowledge. And this has become possible thanks to appearance of cheaper computing hardware and emergence of a large number of simulated environments in 3D. But in order to get practical knowledge in shorter time and at higher quality, it is necessary to create simulators which will clearly and reliably visualize the learning process.
Landscape modeling in Unity3D
Currently, one of the urgent problems and tasks in the design and development of simulators is terrain or landscape modeling that would accurately resemble real landscapes. Therefore, a great role is played by "fair" landscapes that transmit a clear image of the area (location of objects, terrain, physics, environment, etc.) and illustrate the quality of working technical equipment as part of educational process.
In addition to the simulators and other training tools, 3D models of different landscapes play a very important role in the GIS (geographic information systems) and various gaming applications where the environment is simulated in 3D, which makes the applications fun, visually appealing and interesting to play with.
Thus there is a need in the most affordable, easy and quick way to model landscapes and terrain relief with different features. In this article we will discuss in detail the process of creation of highly detailed landscape in Unity3D - a multi-platform tool for the development of three-dimensional applications.
Interface of landscape modeling tool in Unity3D
Standard process of landscape modeling in Unity3D looks like to following:
- Creation and set up of basic parameters (height, length, width) for an empty object called Terrain (it looks like a rectangular plane).
- Creation of height and relief maps and further processing by means of sculptural modeling tools (handled exclusively according to the final goal)
- Applying textures (they can be used either as base textures or created in various graphic editors). It is recommended to apply the textures after creation of the final relief, because otherwise you can get malformed textures.
- Adding various light sources (global and local) and creation of the sky (within the Unity framework it is called the SkyBox)
- Working out details, terrain and objects features (trees, grass, water, stones, etc.)
- Camera placement and set up (allows to create visual effects, or make the users look at the scene as application developer wants)
Mesh optimization techniques for landscapes in Unity3D
Unity engine is quite simple to learn, and most importantly - free. However, to work with large scenes and many objects you need to have a sufficient amount of computing hardware resources. Therefore, from the perspective of work with 3D models of terrain, it is recommended to pay greater attention to productivity issues and optimization of these models.
To reduce the number of polygons the polygon reduction algorithm is used. The reduction is the process of simplifying 3D model of terrain by reducing the number of polygons. The principle of this method is replacement of one group of polygons with those located closer to the original group of polygons by peak location. The majority of 3D editors offer the ability to set reduction intensity that allows you to choose the right balance between the level of detail of a model and saving the processing power.
Polygon reduction tool in Unity3D for modeling of 3D terrain
The advantage of this method includes ease of use and high processing speed. However, the disadvantage of this approach can be a strong distortion of a model when using this method incorrectly. Besides, you will need to redraw the textures if the initial model already had a texture. The image shows that the number of polygons has decreased by times, but at the same time level of details of the image remained almost untouched, so this method can be easily applied in practice solving the problem of saving computing resources.
Also, in the modeling of a landscape it is important to take into consideration that it may have different elements (rocks, trees, buildings, etc.) that will give uniqueness to simulated terrain. The process of real-time rendering of each element is a time-consuming task for a computer. Occlusion Culling is a Unity function that disables rendering of objects invisible to camera at a certain moment or those obstructed by other objects in a given time.
Occlusion Culling tool turns off objects that are not currently visible to the main camera
When creating a landscape in Unity3D one of the key issues to solve is the lighting, because with help of light and shadow you can hide all scene imperfections after its optimization. Lighting options are used to illuminate the objects and create the desired look and feel of the object and application in general. Unity engine allows you to simulate different types of light sources: the sun, street lights, burning fire and so on.
For example, to create the "Sun" we commonly use the tool called Direction Light, as it affects all the surfaces in the scene. The peculiarity of Direction Light is that it consumes only few resources of the GPU while working. To create other light sources, for example, street lights or road lamps we use a tool called Point Light, as it perfectly resembles natural light of street lights or road lamps. However, this type of lighting consumes much more resources of the GPU.
Not least important in the modeling stage is creation of the sky that would be not only realistic, but also consume the least amount of GPU resources. To create the sky in Unity we use a special tool called the SkyBox. It works as a wrapper and is nothing else but a panoramic photo of the sky in a certain state.
Use of the SkyBox in Unity3D
Using the above methods we create and optimize 3D scenes in Unity3D that are to be used in interactive applications on different platforms and devices including mobile, Oculus, AR, etc.
Final 3D terrain created and optimized in Unity3D
Where to apply
When working on suchlike scenes our task is to minimize the number of polygons of the terrain and the number of objects to save computer resources, thus making the application run smoothly in higher resolutions.
During the testing phase such applications show a good FPS performance. It means that the area is modeled correctly according to system requirements. In spite of the fact that modeled area is large, has varied terrain and a large number of objects it doesn’t slow the app down.
The above approach to the creation and optimization of three-dimensional terrain models can be used for development of different types of interactive applications in Unity3D including simulators, GIS systems, interactive apps and games, making this approach versatile and useful.
3D-Ace team is glad to share their know-hows in 3D modeling and expertise of our parent software development company Program-Ace in Unity3D development to provide interactive 3D solutions that are fun, engaging and speedy.