Development Blog #1

Dear Mechanics!

Welcome to our first Development Blog post. We will present here more detailed informations regarding development of Tank Mechanic Simulator. This weekend our Programmer Przemek will present here on what special system he is been working for a while.

Terrain Deformation System

Special effects in games are an addition that can significantly diversify the experience of playing. We can easily mention their various kinds, like visual, physics or sound effects. In thistext, will be described in brief one of the most impressive special effect: real-time interactive mesh deformation system, which is currently under developing for game Tank MechanicSimulator.

Realistic representation of the processes from real world in virtual is not trivial, for exam pleexisting physics algorithms ,such as dynamic large scale fluid simulation ,have high hardware
requirements. To combine quality and performance, we need to use “tricks” , which will give us good approximation without notable performance loss. TMS is game based on Unity engine, so it uses some built-in basic features like physics of rigid bodies and LOD system (level of detail). But for more advanced task, like geometry modification, we use custom solution.

Let’s imagine, we have a terrain model, flat or wrinkled, in form of vertices and triangles. We can programmatically changing position and other parameters of every vertex, so shape modification of selected game object is common operation performed in vertex shader (kind of short program executed directly on GPU). For precise data mapping, structure of vertex modification is stored in depthmap – scalar (R) floating point render texture.

Brighter pixel on depthmap returns higher ground displacement, along normal vector. So, for
every vertex, GPU assigns the appropriate values from depthmap. But how “to bake“ external
geometry (for example vehicle mesh) into terrain depthmap?

First, we use second camera with orthogonal projection and shader replacement to grab geometry data from deformer independently. After coordinates transformation, output frame of second camera is written into another buffer, which contains actual encoded shape of deformer. It can be treated as a kind of brush, but now, similarly, we have to prepare our canvas to accumulate steps of geometry reshaping. Read and write operations on standard type texture will be slow, we need another approach. Once again, we use render texture as our internal buffer – rasterized image (output) from previous frame is set as input for next shader execution.

Our deformation system is flexible and seamlessly works together with all modern rendering techniques, includes DX11 tessellation and physically based lighting. However, that is not all – to simulate deformation process in game scenario, we need not only geometry and lighting models, but also proper collisions to define object position. Currently main physics is calculated on CPU, so in the future we would like to implement GPU accelerated collision detection.

Click here to download Terrain Deformation System Demo

If You have any suggestions, ideas or questions, write to us at contact@degenerals.com or visit our Discord server – https://discord.gg/HPbJj9y

DeGenerals

2 thoughts on “Development Blog #1

  1. Pingback: Tank Mechanic Simulator’s incredible real-time terrain deformation tech demo is available for download | DSOGaming | The Dark Side Of Gaming

  2. Pingback: Tank Mechanic Simulator’s incredible real-time terrain deformation tech demo is available for download – John Smelley

Leave a Reply

Your email address will not be published. Required fields are marked *