Jump to content
  • Advertisement
Sign in to follow this  

Procedural Terrain Texturing on the GPU

This topic is 4244 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A recent project that I was working on required me to revisit the topic of terrain texturing. I started off by looking into an offline approach whereby a single large texture is generated from a height map and several tileable terrain textures. This seemed to work ok but most cards limit the max texture size to about 4K, and I didn't have the time to go into any kind of terrain paging scheme. I was looking for a quick and cheap alternative. Many sources on the web suggests that procedural terrain texturing on the GPU would give better result. My initial experiments with a fragment shader gives some pretty good results. At the moment I'm just blending 4 texture tiles and only using the height to color the terrain. I plan to add slope to the mix later on. I haven't found much in the way of how other people have been implementing this on the GPU. The way I've done it is to include 2 sets of texture coordinates with the terrain mesh vertices. The 1st set is for the height map. The coordinates are for a single height map stretched across the entire terrain. I then use the interpolated texture coordinates to determine the exact height of that pixel on the terrain in the fragment shader. The 2nd set of texture coordinates is what I use to give the terrain texture its overall resolution. Its how much the terrain texture tiles are tiled across the terrain. A low amount of tiling will produce results equivalent to a low res texture stretched across the terrain. The greater the amount of tiling the more detailed the resulting terrain texture will be. However too much tiling and the end result will look "funny" since the tiling will be very obvious. I've posted a demo together with source on my site www.dhpoware.com.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!