Archived

This topic is now archived and is closed to further replies.

Terrain Texturing

This topic is 5776 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

Hello, I am having some trouble texturing my terrain, is there any way i can stretch a bmp over the whole terrain? I have been messing around with opengl for a little bit, and with this particular problem and i have not had any luck. If anyone could point me to some resources on this topic i would appreciate it or if they have any ideas i would appreciate that too, thanks and later- what we do in life... echoes in eternity...

Share this post


Link to post
Share on other sites
Ok, stay with me on this one, I''ll try to explain it:

While you''re rendering the terrain vertices, to get the current texture coordinate get the current vertex''s ''x'' number (in the row), and divide it by the max number of vertices per row... That will get you the ''s'' (''x'') texture coordinate, do the same thing, for the ''t'' (''y'') coordinate.

Hopefully I did a decent enough job explaining this...

Trent (ShiningKnight)
THE Engine
ShiningKnight7@hotmail.com

Share this post


Link to post
Share on other sites
thanks, i understand ya, but as to the side effect? What do you mean, do you mean the texture map not looking good? (i havent tried it yet) and if so do you have any other suggestions? later-
-forget it i see what you mean about the side effect. my terrain tiles are just big ugly blocks, i am gonna try and mess with it some more thanks guys

what we do in life... echoes in eternity...


Edited by - rollinr33 on February 22, 2002 4:17:39 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
the problem that python is describing is that while the polygon won''t be very wide or deep, it will end up having being really tall if the height difference between connecting vertices is great. This results in a abnormally large polygon. If you just use the normal texture mapping technique, the texture on that polygon will end up looking strechted because while the percentage of the texture remains the same as that used on all of the other polygons, this polygon is a lot bigger and thus needs more of the texture to look "normal."

To visually see what would happen, take the picture you use as your signature and enlarge it only vertically.

Hope this helps some.

Share this post


Link to post
Share on other sites
Yeah i think i understand what you are guys are saying, and i dont blame you for not wanting to draw a diagram, the pub can get you sometimes. Anyway, is there a way to correct this side effect? I have the texture coordinates implemented just like shining knight suggested(i should of been able to figure that one out). And i am generating the texture based on the height, little article over at flipcode helped me out there, I am just having problems with getting the texture genrator to work right. But anyway, thanks guys later-



what we do in life... echoes in eternity...

Share this post


Link to post
Share on other sites
quote:
Original post by ShiningKnight
Ok, stay with me on this one, I'll try to explain it:

While you're rendering the terrain vertices, to get the current texture coordinate get the current vertex's 'x' number (in the row), and divide it by the max number of vertices per row... That will get you the 's' ('x') texture coordinate, do the same thing, for the 't' ('y') coordinate.

Hopefully I did a decent enough job explaining this...




Thanks! I did't know that and i was wondering how to figure it out....

As for the distortion effect. This can be fixed by making the bitmap larger than the terrain... ( i think? )

Edited by - Spikeles on February 22, 2002 8:34:55 PM

Share this post


Link to post
Share on other sites
Spikeless, that could reduce the effect slightly, but will not eliminate it. Here are a couple of diagrams that should explain this easier...



Here you can see what you are doing at the moment. You can see that on the steep gradients, when there is a large variation between adjecent vertices, a small amount of texture is mapped onto a large area polygon. This has the effect of stretching the texture alot.



With this one however, it maps the texture not based on the x distance into the terrain, but the actual distance on the terrain travelled. You can see, that this eliminates the stretching, and will look better. So based upon the terrains variation you map a different amount of texture onto it.

The second method is alot harder to actually impliment though, and it will not look much better at all with flat-ish terrains.

Share this post


Link to post
Share on other sites
That side effect isn''t that noticable when using very seamless textures.

Here are some pictures I took from my future game:

http://www.konstantin-schauwecker.de/game-shots/graph/snap1.jpg
http://www.konstantin-schauwecker.de/game-shots/graph/snap2.jpg
http://www.konstantin-schauwecker.de/game-shots/graph/snap3.jpg

Share this post


Link to post
Share on other sites