Question on terrain texturing methods pertaining to speed

Started by
4 comments, last by Richy2k 18 years, 8 months ago
Hello everyone, I've created a nice terrain engine that has a great bottleneck when it comes to GPU processing the terrain's texture. My current method is a main overlay texture, then a shadow map, and finally a 3D detail texture (which isnt used at great distances). The problem is when I look at a moutain (large flat surface with 3D texture on it), it slows down tremendously. I know 3D textures probably aren't the way to go for terrain. I've recently learned CG, and I have an idea how to use texture splatting. With the CG source I'd have 1 texture that uses it's 4 channels to chose which overlay texture to use, 1 texture that contains the textures to use (1024x1024 texture, each detail is 512x512), and 1 texture for shadows. My main concern with this method is to me it seems to be taking more samples of a texture than a 3D texture would be: Texture splatting: 4 detail textures, 4 samples each (Linear) = 16 samples 3D textures: 16 samples (cubic) I'm mainly wondering if this is the right way to go, switching to splatting. I believe it is. Another question: How many texture pipes does a moderate graphics card have these days (say, a GeForce 4 up). If it has 4 pipes I'd like to continue using my main overlay texture along with texture splatting, and shadow map. Thank you for your replies ~zix~
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
Advertisement
3D textures still take up a lot more memory (and therefore bandwidth) and have less hardware support.
Quote:Original post by dyerseve
3D textures still take up a lot more memory (and therefore bandwidth) and have less hardware support.


A 3D texture size of 512x512x4 (RGB) is the same as a 1024x1024 texture (RGB), so it should have the same size in both cases. That is true, graphics cards probably optimize 2D textures more than they do 3D.

I'm still wondering if I need to go thru. all the code and change it.

Thanks again
~zix~
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
I'm having similar problems, but i've went for texture splatting rather than 3D textures. I have an alpha texture (512x512 A), a tiled texture (256x256 RGB) and a normal map (256x256 RGB) for each layer, then I process the each layer within a shader program. Its inherently slow, especially since I have to have multiple passes to render this without relying on lots of texture units, I can get some really nice results from it, but I'm still working on a way to optimise. I ditched the idea of 3D textures a while ago, as i couldn't have a fade for, for example - grass to snow if my texture went grass, rock, snow. Oh i'm going to have fun when I add shadow mapping.
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd
Well, Richy..
If your using a shader program you should be able to treat all 4 channels in a texture (RGBA) as seperate alpha channels, which brings down the amount of alpha textures you need, and then you can combine the detail textures into one large texture (2048x2048 can hold 16, 512x512 textures). I don't remember where I read about this method, someone here on the forums had the idea a few weeks ago I believe. That's just 2 texture units, 1 pass, and 1 shader.

If you are using CG I may be able to provide the source for the shader (if you need) after I write it myself :)

~zix~

Edit: I'm a horrible speller.

[Edited by - zix99 on August 15, 2005 12:59:48 PM]
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
Now that you mention it, yeah I could! But i'm trying to keep down the number of texture units I use, i'm going to combine passes and write a shader and seperate rendering path for hardware in plentiful supply of texture units, why not take advantage of them? Also, i'm rendering 4-8 different layers, I might have a stab at your idea of combining textures sounds like a good reason to experiment. My engine is still a WIP, as I learn more I write more. Also, i'm using GLSL.

Addition: Yeah I remember the post of combining textures, filtering messed it up a little, but there was ways around it, not without extra effort though.
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd

This topic is closed to new replies.

Advertisement