Heightfields allow for a basic 2D texture mapping strategy: Repeated tiling textures can simply be projected vertically onto the XZ plane. In other words, the vertices' XZ values can simply be interpreted as (scaled) texture UVs. This basic projection works well for flat land and even hills, but causes noticeable stretching on very steep and rough terrain.
For steeper features, a projection along a more perpendicular (and thus horizontal) direction is more desirable. Hence, a more complex projection strategy was also implemented: Instead of only projecting the textures vertically, they are also projected along the X and Z axis. The outputs of the three sampled projected textures are blended based on the pixel's normal direction. That way, flat areas will continue to use the vertical projection, while steeper areas blend in results from more horizontal projections. The technique's advantages are especially noticable on steep terrain features, as shown here. In a pixel shader, this can simply be implemented as:
When enabled, the above is executed four times in this implementation's pixel shader: once for each of the four texture layers. Note that the three weights will always add up to exactly 1.0 for normal vectors (assuming they are properly normalized), as x2 + y2 + z2 = 1.0, so no additional weight normalization is needed. Furthermore, when compared to powers other than 2, using the square of the normal components as weights also strikes a pleasing balance between preventing unnecessary blending and offering smooth transitions between projection directions.
This is very interesting, could a projection technique like this realistically be implemented in spring?
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
ooh advances! Does this also fix the problem of "morphing" textures when moving the camera? I do not mean the terrain LOD adjusting but this "popping" where on some maps the side of a steep wall changes color when viewed from different angles.
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum