Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: How to texture a terrain?

  1. #1
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    How to texture a terrain?

    Hello,

    Now, I have created a LOD in order to render a terrain I would texture it.

    I could use multitexturing to render the different zones that have the same material and then making transitions between them.
    But the size of polygons is variable and I can't render details like a road that is mapped in the middle of a big polygon created by the LOD.

    So, I have an other solution: I could apply big texture on a big part of terrain but it imply to load severals big textures in system memory...
    If I use 1024*1024 textures what polygon surface can I texture with a such texture?
    The problems is that I can't load many such a texture in system memory and I think that loading these textures from the hard disk during the game is not effficent...

    Are there other solutions to texture a terrain?

    Thank you.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,662

    Re: How to texture a terrain?

    If you want to keep this way your first idea seems the best: cut your terrain into several portions, say quad portions so that texture coordinates will be quiete easy to calculate. Or let GL calculates the texture coordinates for you (using object linear tex gen).

    About texture size and object size, I also just can guessing that texture size should fit pixels. This is for 'perfect' result of course.

    Btw, I don't see why LOD prevents you from doing it the way you wanted. When using LOD you generally only add or avoid polygons but you don't move them, so texture coordinates remain the same.
    Or am I missing something ?

    Hope that helps a bit.

    EDIT: avoid using big polygons, this is not a good idea since common hardware are only fillrate limites but not polygon limited. Also for lighting, big polygons tend to give less good results.

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: How to texture a terrain?

    There is the megatexturing method, basically it's a 1024x1024 texture repeated over the whole terrain.
    and as you move along the texture you load and replace small(32x32) parts of it using glTexSumImage2D.

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: How to texture a terrain?

    Thank you for your reply.

    "common hardware are only fillrate limites but not polygon limited"

    In this case, what is the interest of LOD and why my program could be more powerful with it?!

    Yes with LOD the texture coordinates remain the same but the transition between two dufferents textures could move because the shape of triangles changes. So, the polygons used by transitions will create transitions more or less broad...and the texture will move.

    Moreover the little details could disappear when the size of polygons increases...that's why I think it is not possble to texture a terrain in this way.

    zeoverlord > I'm not sure, I understand everything you say...
    I dont see the interest of loading piece of texture like 32*32 from a 1024*1024 and it imply to load and free textures very often...

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: How to texture a terrain?

    no actuarly you only load like one of the bits per frame (and then not every frame) into the large texture, so you get low owerhead and a virtual texturesize that is near infinite.
    This way of doing things is not unheard of in the console market but it is pretty rare in pc's, and that's a shame since it means that you can use the texture memory more effectively.
    Just watch out for memory leaks.

    About terrain LOD, it used to be faster to use cpu power to make terrains more efficient.
    But on todays hardware it would use up to much CPU processing power to optimize a mesh to the maximum a GPU can process.
    this is because poly pushing power is linear while terrain lod CPU usage is more or less exponential.
    So on todays hardware it's probably better to use raw poly pushing power(mixed with some simple frustrum culling) instead of LOD.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,662

    Re: How to texture a terrain?

    Yes, it is generally more efficient to have several little polygons instead of a big one, mainly for lighting issues and this won't slow things down.

    LOD are generally interresting for far objects. It is in fact more simple to draw less polygons if they are far so that lighting and such could be done more easily. If you have thousands of polygons that are only seenable with few pixels, GL will loose time for calculating all the faces all the lighting, all the texture application, fog... but if you only reduce them to few triangles, this turns out.

    Of course when you use LOD the relief of the object change, it gets more and more flat. This is why that generally when you use LOD you use some tricks like blending to reduce the hurts on the changes.

    The trick zeoverlord talked about could also help, it was commonly used on 2D game consoles like Super Nes (for Zelda...).
    The way you want to texture your terrain is quiete well even if I guess I would try to do it in another way. But I must admit each time I tried to make a terrain with a road (in a modeler) I failed (but for simple maps). I guess the best thing is to separate the road geometry from the land, but this is a tricky modeling stuff. Also I might be wrong.

  7. #7
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: How to texture a terrain?

    "no actuarly you only load like one of the bits per frame (and then not every frame) into the large texture, so you get low owerhead and a virtual texturesize that is near infinite."

    My english is maybe too bad because I don't understand this sentence...so I don't understand what console does...

    The problem while using big textures is the memory space ( in system memory ) that they occupy...
    The textures can't have precisely a too huge size for this reason...that's why it doesn't seems to be a good idea for huge terrains that require many big textures...

    About LOD, there are relatively big polygons far from the camera...near it the polygons are little.It is the LOD principle. So I can't change that. However I would "paint" details smaller than polygons and multitexturing doesn't allow me to do it.

    An other idea is to apply LOD only on polygons that have the same material...but on a terrain the material changes relatively often, so the LOD would not be finally very efficient...
    Moreover frustrum culling is not sufficient...especially when the camera is high ( in a plane) so when we have a global view of terrain...

    thank you.

  8. #8
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: How to texture a terrain?

    In fact, now I have understood now what you said but it is not possible to load texture pieces of 32*32 gradually, because the terrain will be use in a rts...so with the minimap I have to load big textures because the camera movement is like teleportation...
    So I don't see an other way to do this without loading all big textures at the beginnig of the game...

  9. #9
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: How to texture a terrain?

    google for "geometry clipmaps".
    Use it for both your terrain height data *and* your terrain texturing.
    Megatextures are just clipmaps, and geometry clipmaps are a more generalised form of clipmaps.
    Knackered

  10. #10
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: How to texture a terrain?

    I know what is geometry climaps...In the beginnig I wanted to do this but it is not an efficient simplification mesh method...Moreover with this method I have to build terrains with a high vertice density in order to don't obtain gaps between consecutives simplification levels.

    But the problem is not my LOD it is only about texture mapping. I thought about a kind of texture clipmaps but this is not the first problem i.e memory space.
    SO I think, despite everything, that I don't have any solution, I have to implement multitexturing and give up accurate texture mapping...

    Thank you for your help.

Page 1 of 3 123 LastLast

Similar Threads

  1. Multi-Texture Terrain
    By naitomea351 in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-25-2018, 04:30 PM
  2. texture to terrain
    By phoenix07p in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 07-01-2009, 06:36 AM
  3. Texture Blending in a Terrain
    By Manux in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-17-2008, 03:46 PM
  4. Rendering 3D terrain with more than one texture
    By yossi in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 01-31-2007, 10:53 AM
  5. Terrain texture bug
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-02-2003, 04:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean