From cf1be723a843304cf315d59daa8e47b386ecff01 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Fri, 19 Aug 2022 23:09:11 +0100 Subject: [PATCH] Note about texture arrays --- doc/source/smooth_terrain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/smooth_terrain.md b/doc/source/smooth_terrain.md index 0b828767..e2486349 100644 --- a/doc/source/smooth_terrain.md +++ b/doc/source/smooth_terrain.md @@ -623,7 +623,7 @@ void fragment() { Normal-mapping usually requires texture coordinates (UVs). However, smooth voxel meshes aren't trivial to UV-map at runtime. Some methods exist to generate UV-maps on completely arbitrary meshes, but they are too expensive for realtime, or inappropriate for seamless chunked terrain. So instead, we can use a form of "virtual texturing". -The mesh is first subdivided into a grid of cells (we can use Transvoxel cells, which are ready to use). In each cell, we pick an axis-aligned projection working best with triangles of the cell using the average of their normals. A tile can then be generated by projecting its pixels on triangles, evaluating a normal from voxel data, and storing it in an atlas (to avoid filtering issues, we can use a TextureArray). A shader can then read the atlas using a lookup texture to find the tile. The lookup texture is a 3D texture that tells for each "cell" where is the tile in the atlas (but it can be stored as a 2D texture). +The mesh is first subdivided into a grid of cells (we can use Transvoxel cells, which are ready to use). In each cell, we pick an axis-aligned projection working best with triangles of the cell using the average of their normals. A tile can then be generated by projecting its pixels on triangles, evaluating a normal from voxel data, and storing it in an atlas (a TextureArray could be used, but it has more limited number of layers). A shader can then read the atlas using a lookup texture to find the tile. The lookup texture is a 3D texture that tells for each "cell" where is the tile in the atlas (but it can be stored as a 2D texture). ![Image of an atlas of voxel normals](images/virtual_normalmap.webp)