• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
nbertoa

[D3D11] Terrain LOD using Compute Shader

0 posts in this topic

Hi community. I finished a new mini project using DirectX 11.

Simplified Terrain Using Interlocking Tiles

The Algorithm
Greg Snook introduced an algorithm that mapped very nicely to early GPU architectures, in Game Programming Gems 2. The algorithm was useful because it did not require modifying the vertex or index buffers, because it used multiple index buffers to provide a LOD mechanism. By simply rendering with a different index buffer, the algorithm could alter the LOD and balance performance and image quality.

The algorithm breaks up the 2D height-map texture into a number of smaller tiles, with each tile representing a 2^n + 1 dimension area of vertices. This vertex data was fixed at load time and simply represented the height at each corresponding point on the height map, which also corresponds to the highest possible detail that can be rendered. For each level of detail, there are 5 index buffers. Those buffers represent the central area of the tile, plus one index buffer for each of the four edges.

LOD Calculation
A jump between any two levels of detail is possible, but this may cause popping to become noticeable. The simplest way to avoid this popping is to only transition between neighboring LOD levels, or in severe cases, to consider vertex blending or other morphing enhancements.

Typically, the biggest and most noticeable pops are transitions at the lower end of the LOD scale, such as from 0 to 1, where the geometric difference between the two states is highest. Transitioning at the top end, such as from 4 to 5, will not be as noticeable, since the mesh is already quite detailed, and the triangles are relatively small, making the geometric difference small. Large changes to the silhouette of the terrain tend to be particularly noticeable due to their prominence in the final image, and should be ideally avoided. Unfortunately, the simplest metrics for deciding the level of detail will typically set the geometry farthest from the camera to the lowest level of detail.

We will show 2 examples:

(1) Naive implementation: We will compute midpoints for of the 5 tiles (tile being rendered + 4 neighbors tiles). After that we will compute the distance from each midpoint to the camera to generate a raw level of detail for each of the 5 patches, and finally these LOD values are assigned to the 6 output values that Direct3D expects (Tessellation Constant function: 2 inner factors and 4 edge factors)

(2) Height Map Pre Pass: It is preferable to focus tessellation on areas where it is most noticeable. The above Naive Implementation clearly demonstrates that will neither generate high quality , nor high performance results. Most detailed areas are not necessarily the areas which need more details. We will divide the input height map into kernels; each kernel area will have its pixels read in, and four values will be generated from the raw data, which can then be stored in a 2D output texture. This texture will then be used to compute LOD. A good objective for this pre-pass is to find a statistical measure of coplanarity, i.e. what extend the samples lie on the same plane in 3D space.


Multitexturing

We do not want to be limited to a single texture. We would like to create terrains depicting sand, grass, dirt, rock, snow, etc, all the same time. We cannot use one large texture that contains the sand, grass, dirt, etc, and stretch it over the terrain, because we will have a resolution problem, the terrain geometry is so large, we would, require an impractically large texture to have enough color samples to get a decent resolution. Instead, we take a multitexturing approach that works like transparency alpha blending.

The idea is to have a separate texture for each terrain layer (e.g. one for grass, dirt, rock, etc). These texture will be tiled over the terrain for high resolution. Also we need to include transparency alpha blending. The blend map, which stores the source alpha of the layer we are writing indicates the opacity of the source layer, thereby allowing us to control how much of the source layer overwrites the existing terrain color. This enables us to color some parts of the terrain with grass, some parts with dirt, and others with snow, or various blends of all three.
 

Improvements

One particular limitation of this implementation is that it still retains an element of distance in the LOD calculation. Geometry further from the camera is always assumed to be less important, and to require less detail.

It is worth extending the terrain algorithm to weight features on the horizon higher than distant objects that are less pronounce. The silhouette of a model is one of the biggest visual clues of its true level of detail, and is one of the more obvious places for the human eye to pick up on approximations or other visual artifacts.

Interacting with the terrain is another problem. The core application running on the CPU has no knowledge of the final geometry, which is generated entirely on the GPU. This is problematic for picking, collision detection, etc. One solution is to move picking or ray casting to the GPU, or use the highest level of detail.

Bibliography
Game Programming Gems 2
Introduction to 3D Game Programming with DirectX 11
Practical Rendering and Computation with DirectX 11
Real Time Rendering

Video Demonstration

http://www.youtube.com/watch?v=-hMIDb9bE3o

Edited by Nikko_Bertoa
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0