Skip to main content
gamedev.net
🔒 Locked

Terrain question

Started by ManaStone 3 replies 1k views
Original Post
ManaStone
ManaStone
When rendering the terrain, how exactly do you do it so that U V coordinates are correct? What I mean is that when vertices are shared you might want them to have 2 separate UV coordinates depending on which triangle you are rendering. For example, say that the following UV coordinates represent each vertex on a height map: (0,0) (1,0) (0,0) (0,1) (1,1) (0,1) You are going to be able to put 2 textures on this, one which should render normally, and the other which should render it mirrored. The only way I can think of to fix this problem is to split the height map up into four different parts and render them separately, sending a different texture coordinate array in for each one. Is that the way you are supposed to render it? Also, how efficient is it to call to call glBindTexture() for each different texture on the terrain? Should I separate the terrain into different sections that use the same texture and render each part separately or should I use one giant texture and just use the UV coordinates to determine which texture I should use?
-----------------------------Download my real time 3D RPG.
BTierens
BTierens
You could put all your textures in one texture. And you calculate your uv-coordinates so that you cut a piece out your large texture.

I suppose that you are using vertex arrays?
ManaStone
ManaStone
Yeah, I'm using vertex arrays. So that is how textures are usually done for terrains? What about the way I proposed to do the UV coordinates? Is that the standard way to do that as well?
-----------------------------Download my real time 3D RPG.
Trienco
Trienco
Quote:
Original post by ManaStoneIs that the way you are supposed to render it?


dont fall for the "is that the _right_ way to do it" illusion. you are not supposed to do anything in any particular way and if you feel like it you can just forget about storing any tex coords at all and generate a bunch of them in a vertex shader.

dont look for a _right_ way or how others are doing it, look for the way thats working best for YOU.
f@dzhttp://festini.device-zero.de
ManaStone
ManaStone
Well, what I mean is, is that the most efficient way to do it?
-----------------------------Download my real time 3D RPG.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.