# Terrain + Texture Compression

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

## Recommended Posts

Hi guys, I thought about various ways to texture my terrain and decided on using a huge base texture for things far away and blending it with detail textures for things close by (if thats a bad idea, please let me know). Now I considered to use a 1024 x 1024 heightmap and generate a 8192x8192 basemap for it which I hope is not too big. The basemap would be 8k*8k*4 = 256MB memory which is way too much. With texture compression I should get it down to 32MB memory. Since I have absolutely no experience with texture compression, I would like to ask you some things about it: 1. Does using TC decrease the rendering performance (fps) generally or in certain situations ? 2. Are the results I could get with this kind of technique acceptable in quality considering I will use the compressed texture only for things far away ? 3. I don't need alpha so would color (5:6:5) = D3DFMT_DXT1 be the right kind of compression ? If am looking forward to your answers... ^_^

##### Share on other sites
Yes, DXT1 would be the best format. Note, however, that by using 8192x8192 textures you're limiting your user base to people who have DX10 level hardware.

##### Share on other sites
If you've got a 1024x1024 heightmap, I would suggest using something like a 2048x2048 (or less) base texture to give a more organic feel to your detailed level. I don't think you need to go as detailed as 8192 for a base layer. If you use texture filtering on the base texture, it should blur nicely under the detailed textures.

You can then perhaps use splatting over the top to introduce more detail and for the odd extra different area like oil spills on roads, etc, use a transparent decal or something projected onto the terrain.

If you've got it, I'd advise having a look at Sandbox 2 (free with Crysis) - after playing about with terrains and surface and detail texture layers, you can see how they do it which is similar to what I've described above.

Hope that helps.

##### Share on other sites
Quote:
 Original post by RobMaddisonIf you've got a 1024x1024 heightmap, I would suggest using something like a 2048x2048 (or less) base texture to give a more organic feel to your detailed level. I don't think you need to go as detailed as 8192 for a base layer. If you use texture filtering on the base texture, it should blur nicely under the detailed textures.

Well, I wanted to go that high with the resolution so that I can use it as a sufficiently detailed map by itself from some distance on. The added detailed textures are mostly only put close to the viewer because the triangle count adds up pretty quickly and I thought I could manage that with a high detail base map.

Quote:
 Original post by RobMaddisonYou can then perhaps use splatting over the top to introduce more detail and for the odd extra different area like oil spills on roads, etc, use a transparent decal or something projected onto the terrain.

That's what I am planning to do...

^_^

Quote:
 Original post by RobMaddisonIf you've got it, I'd advise having a look at Sandbox 2 (free with Crysis) - after playing about with terrains and surface and detail texture layers, you can see how they do it which is similar to what I've described above.

That sounds interesting. A friend of mine has crysis and I think I have to check it out.

Quote:
 Original post by RobMaddisonHope that helps.

Definitely...

^_^

##### Share on other sites
Quote:
Original post by Zaph-0
Quote:
 Original post by RobMaddisonIf you've got a 1024x1024 heightmap, I would suggest using something like a 2048x2048 (or less) base texture to give a more organic feel to your detailed level. I don't think you need to go as detailed as 8192 for a base layer. If you use texture filtering on the base texture, it should blur nicely under the detailed textures.

Well, I wanted to go that high with the resolution so that I can use it as a sufficiently detailed map by itself from some distance on. The added detailed textures are mostly only put close to the viewer because the triangle count adds up pretty quickly and I thought I could manage that with a high detail base map.

2048x2048 is safest in terms of hardware support, since all cards for quite a few years have supported it. 4096x4096 is available on Radeon x1x00 family and all GeForce cards since GeForceFX (5x00 family). 8192x8192 is only available on cards supporting DX10 (GeForce 8x00 and up, Radeon HD). So choose the size depending on your audience.

The Graphics Card Capability spreadsheet (available from the DirectX Sample Browser in the SDK) will give you more details of which cards support what.

##### Share on other sites
The other answers you were after:

1. DXT textures are faster than uncompressed as they use less memory bandwidth. I've never seen them reduce FPS, and they often increase it.

2. Many games compress almost all of their textures with DXT1 / DXT5 - the quality loss is usually minimal even close up, although you can lose some fine detail. The compression works best on textures that don't use many different colours in any 4x4 block.

##### Share on other sites
The only issue with DXT is that load times are considerably higher. Especially if you let HW create all mipmaps, then the total load time is doubled-tripled - which is a lot. I heard that if you let DXT tool create mipmaps for you, that the load time is considerably lower.

If you use a lot of textures, the performance goes up with DXT textures. Especially, if you have used all your VRAM and driver needs to swap it. Then you can clearly see that you can load much more textures without driver needing to start swapping.

Try using DXT to see that you can use the textures for close-ups too. The visual difference is negligible, compared to huge memory savings - 8:1 ratio is really a lot !

Rest assured theres a lot of work in front of you in regards to adjustments of the textures - their contrast/brightness/ color distribution until it fits with the base terrain.

Another advice: Its more work, but go for 2 detail layers, the second one used only for nearest terrain chunk and being mostly a black-white noise, so its easy to blend with previous 2 layers. Then, you dont need your first detail layer to be of high resolution, only the second one.

##### Share on other sites
Quote:
 Original post by VladRThe only issue with DXT is that load times are considerably higher. Especially if you let HW create all mipmaps, then the total load time is doubled-tripled - which is a lot. I heard that if you let DXT tool create mipmaps for you, that the load time is considerably lower.

There's a plugin available for photoshop and another for gimp that will let you export images as DDS, and generate those mipmaps at tool time. Doing this, your load times will be faster* than other formats.

* remembering that hard drive access is usually the bottleneck for loading speed, so you'll want to compress the textures as a tool step (yes, you're compressing compressed textures. I know it's weird, but it works usually), and have your program uncompress them at load time.

edit: You will find this useful if you're working with DDSs. With it you can take a 32 bit source image (in DDS), convert it to DXT1 (or 2 or 3 or 4 or 5 or a bunch of other formats), and see the image degradation. And even save out the compressed version.

##### Share on other sites
Quote:
Original post by ET3D
Quote:
Original post by Zaph-0
Quote:
 Original post by RobMaddisonIf you've got a 1024x1024 heightmap, I would suggest using something like a 2048x2048 (or less) base texture to give a more organic feel to your detailed level. I don't think you need to go as detailed as 8192 for a base layer. If you use texture filtering on the base texture, it should blur nicely under the detailed textures.

Well, I wanted to go that high with the resolution so that I can use it as a sufficiently detailed map by itself from some distance on. The added detailed textures are mostly only put close to the viewer because the triangle count adds up pretty quickly and I thought I could manage that with a high detail base map.

2048x2048 is safest in terms of hardware support, since all cards for quite a few years have supported it. 4096x4096 is available on Radeon x1x00 family and all GeForce cards since GeForceFX (5x00 family). 8192x8192 is only available on cards supporting DX10 (GeForce 8x00 and up, Radeon HD). So choose the size depending on your audience.

Yes, going with a lower maximum res for the detail map would be better for compatibility but at first I want to go with maximum visual quality and then downgrade it as necessary.

Quote:
 Original post by ET3DThe Graphics Card Capability spreadsheet (available from the DirectX Sample Browser in the SDK) will give you more details of which cards support what.

Thanks, I'll check that out.

##### Share on other sites
Quote:
 Original post by Adam_42The other answers you were after:1. DXT textures are faster than uncompressed as they use less memory bandwidth. I've never seen them reduce FPS, and they often increase it.

I have heard that too but unfortunately still haven't gotten around to test it (trying to implement dynamic lighting atm). I know that the overall bandwith goes down but I wasn't so sure about the time needed for decoding the compressed textures and thought that might decrease the performance. But if the reduced bandwith compensates and exeeds the decoding than that would be very good indeed.

Quote:
 Original post by Adam_422. Many games compress almost all of their textures with DXT1 / DXT5 - the quality loss is usually minimal even close up, although you can lose some fine detail. The compression works best on textures that don't use many different colours in any 4x4 block.

I have to make a comparison between compressed and noncompressed textures to see if the loss in detail for close-up textures is acceptable. For my low detail terrain map which is only seen at a distance anyway I think it definitely will be ok.

• 36
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631360
• Total Posts
2999546
×

## Important Information

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!