PDA

View Full Version : How to texture a terrain?



dletozeun
06-14-2006, 01:59 PM
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.

jide
06-14-2006, 02:48 PM
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.

zeoverlord
06-14-2006, 03:21 PM
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.

dletozeun
06-14-2006, 03:58 PM
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...

zeoverlord
06-14-2006, 05:49 PM
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.

jide
06-15-2006, 04:51 AM
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.

dletozeun
06-15-2006, 08:38 AM
"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.

dletozeun
06-15-2006, 01:55 PM
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...

knackered
06-15-2006, 02:01 PM
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.

dletozeun
06-16-2006, 08:59 AM
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.

06-16-2006, 09:11 AM
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.huh?

06-16-2006, 09:15 AM
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...what?

dletozeun
06-16-2006, 11:12 AM
excuse me..what is the problem? I don't understand what you want to say by 'huh?' and 'what?'...
-I said some silly things?
-My english is not clear understanding?

jide
06-16-2006, 12:44 PM
Don't pay any attention to that.

Unfortunately I can't try to help you anymore, this is out of my capabilities.

Obli
06-16-2006, 02:11 PM
Originally posted by knackered:
Megatextures are just clipmapsIn fact I was very disappointed when I discovered this "megatexturing" stuff is just paged texturing. This is ugly.

By the way, although I can find many cases in which this is useful, I think repeating the texture will still be quite common. It takes less money to produce and the result is often good enough.

Anyway, although bruteforcing terrain is pretty feasible, I would still do LOD. Some reasons:
1- It's practicing it, if you care.
2- A thing is avoiding bottlenecks, a thing is trashing performance: even if this is not bottlenecking there would be no quality improvement either.
3- LoD can still play a major role if you don't fit the RAM (rather unlikely for experiments but sometimes happens).

jide
06-16-2006, 03:38 PM
I'm actually pretty sure little textures is the best thing. Very large textures might better fit for very high detailed objects but not for a complete scene, almost on today's games where levels are getting more and more big.

As I said before I'm also pretty sure making a difference between the terrain geometry and the road geometry is the best thing even if it's an overhead for modelers. With this method you don't waste your memory for textures and you can make even bigger levels, more LODs...

I haven't looked deeply at RTS so I'm not really sure, but this is how I would start one.

dletozeun
06-17-2006, 07:37 AM
Thanks a lot! I agree with you.

So big texture is not a good solution for huge terrains texture mapping.

With a LOD, I have an other solution: I can just simplify the zones that have the same material! In this case I won't have problems with details that disappear...but the terrain LOD will be less efficient...
I have no other solution, so I will do that.

06-17-2006, 12:08 PM
this thread reads like the confession of psychotic schizophrenic.

dletozeun
06-17-2006, 01:02 PM
LOOOOOL!! Maybe it is you the psychotic schizophrenic who waste his time on thread like that because he doesn't understand everything we are talking about!

knackered
06-17-2006, 07:07 PM
Originally posted by dletozeun:
[QB]So big texture is not a good solution for huge terrains texture mapping./QB]That's a pretty funny sentence.
Man, it's 2006 and you're talking as if you've just invented terrain texture tiling. Everybody else has been doing it that way for years, but now the hardware makes more ambitious visual fidelity possible, so hacks like that are being dropped quicker than....something very unpleasant to hold.

I think I know what '?' means, it really does look like jide's got himself another login and is having a chat with himself.

jide
06-18-2006, 08:10 AM
I must admit ? recalls me someone...

dletozeun
06-18-2006, 09:29 AM
knackered> I know it's 2006 and you are talking to me as if I was pretensious and boasting!? I am not like that...I praised myself about anything! I suppose that it is boring for you to talk to beginners, I'm sure you know many things about opengl but please don't judge people.

So, bye, thanks all a lot for your help...Now, I think that I will succeed in this task with your advices.

knackered
06-18-2006, 04:53 PM
I've just found out, ? is apparently the seed of my loins, hidden away for 16 years by a mad old bag I once banged.

RigidBody
06-19-2006, 03:10 PM
maybe he's just your alter ego- dr knackered and mr ?

can you remember what you did on 06-17-2006 at 7:08 pm CET?