Height Map Loader, problem

Member
Posts: 36
Joined: 2004.10
Post: #16
Hmm,

well to make my terrain into different parts wont i have to get the Height and then get the X, and Y then texture it with wat texture i want?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #17
yeah, if you're doing it per-polygon that'll work. I read per-vertex into what you wrote above.
Quote this message in a reply
Moderator
Posts: 3,573
Joined: 2003.06
Post: #18
Zwilnik Wrote:Jon's method would work, but would be slower than drawing the terrain in several parts (especially if each part was pre-compiled), but that would assume that the terrain isn't going to be modified.
I agree. You could still have deformable terrain but you'd have to use VBO or VAR if you wanted to retain performance.

That NeHe example is terrible for performance since it draws every face as a single quad. It's better to do things in batches with OpenGL such as using indexed triangle meshes with glDrawElements or using quad strips or even triangle fans. One major reason for doing it in sections, like say breaking the terrain up into 8 x 8 vertex geometric tiles, would be to allow for view frustum culling. It also allows for easier implementation of simple CLOD algorithms like geo-mip-mapping. Drawing the terrain in sections (tiles) is just better all the way around IMHO.

Terrain texturing can actually be done in many different ways. Such as:

- Texture the whole world with one or several big-ass textures. Not a good idea, but effective.
- Color the vertices and stretch or repeat a grayscale detail texture over that. I think the old SkyFly example does it like that. This is a procedural technique and doesn't offer much control but looks really cool.
- Stretch one or several large textures over the world and use muti-texturing with grayscale detail textures (at least two texture units required, or two rendering passes) to fake close-up detail. I think Halo does it this way. This is one of the best ways to go I think, but it's not totally easy.
- You can also do other stuff like full multi unit multitexturing, but it's probably the most difficult if you ask me and does somewhat restrict currently available target hardware.
- Texture each geometric tile with a straight-up texture. I think X-Plane does it this way and it looks really good.

The best looking terrain I've seen is either using the detail texure method (here's a cool article), or like Torque does with on-the-fly texture blenders (which I still don't understand how to do). Nanosaur2 terrain looks real nice too, but I can't figure out how it's done. It looks multitextured but I can't say for sure. Right now I like to use the last method (X-Plane style) with simple 8 x 8 indexed triangle meshes, individually textured, using glDrawElements. It's the easiest with the biggest bang for the buck I think.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #19
Correct me if I'm wrong, but I think the current "cool" for terrain are splat shaders. Repeating textures like rock, grass, dirt, road.. that are controlled by a low resolution control texture. Using much cleverness.

Sorry, I meant polygon but typed vertex.

-Jon
Quote this message in a reply
Member
Posts: 36
Joined: 2004.10
Post: #20
Hey aarku, thanks for the explanation,

Well yesterday me and NickGravelyn did it so i would load all the data in a array then i would draw it according to height and texture it according to height. I put the data loading in one functin and drawing in another. Then i called the data loading in the drawing function then i drew it. The problem is that i dont get all the quads for some reasoning and its reallly slow.

Ill poste my code later, im in school right now.

thanks
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #21
See you're getting the problem I warned you about. Don't call the loading function in the drawing function. You only need to do the loading function ONCE when your game starts up. You can draw every frame, but you don't need to load the data in every frame (it's not changing, after all).
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #22
AnotherJake Wrote:Terrain texturing can actually be done in many different ways. Such as:

- Texture the whole world with one or several big-ass textures. Not a good idea, but effective.
- Color the vertices and stretch or repeat a grayscale detail texture over that. I think the old SkyFly example does it like that. This is a procedural technique and doesn't offer much control but looks really cool.
- Stretch one or several large textures over the world and use muti-texturing with grayscale detail textures (at least two texture units required, or two rendering passes) to fake close-up detail. I think Halo does it this way. This is one of the best ways to go I think, but it's not totally easy.
- You can also do other stuff like full multi unit multitexturing, but it's probably the most difficult if you ask me and does somewhat restrict currently available target hardware.
- Texture each geometric tile with a straight-up texture. I think X-Plane does it this way and it looks really good.

My approach, which has worked well for me, is to use four texture units. I have a primary and secondary ( like grass & rock ), a detail texture, and a colormap/mixmap in the fourth unit. The colormap modulates color and allows me to supply a shadow map, and the alpha channel is used to mix between primary and secondary textures. Works great for me. For machines without enough texture units, I drop the secondary texture and use per-vertex color assignment for the colormap. This way I still get shadows and a detail texture.

The colormap/mixmap is calculated dynamically when the terrain is generated.
Quote this message in a reply
Member
Posts: 36
Joined: 2004.10
Post: #23
Hey guys thanks for the reply,

Nick ill try that today, that might be my problem.
tommorowplusX, thats a good idead, ill do that if the one im doing right now doesnt work.

thanks
Quote this message in a reply
Member
Posts: 320
Joined: 2003.06
Post: #24
I've said this before on a similar thread..... Why use height maps? I went down that path and it's not easy. You'll have to make the terrain engine dynamically change the level of detail based on the distance from the camera.... you won't be able to easily add higher detail areas where it's needed..... It's harder to create a world with a height map than it is with a 3D modeling app.... You'll have more control over textures and shaders and what areas they cover if you use 3D models.... You have to write and maintain a separate loading engine for the terrain and any other 3D models.... You will find it difficult to integrate height maps into existing physics libraries..... Have I said enough?

None of the above is easy... and I mean it's pretty damn difficult. You would be better off writing an engine that loads 3D models and writing a tool that turns height maps into 3D models, if that's what you're aiming for. What are you aiming for?

Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #25
reubert Wrote:I've said this before on a similar thread..... Why use height maps? I went down that path and it's not easy. You'll have to make the terrain engine dynamically change the level of detail based on the distance from the camera.... you won't be able to easily add higher detail areas where it's needed..... It's harder to create a world with a height map than it is with a 3D modeling app.... You'll have more control over textures and shaders and what areas they cover if you use 3D models.... You have to write and maintain a separate loading engine for the terrain and any other 3D models.... You will find it difficult to integrate height maps into existing physics libraries..... Have I said enough?

None of the above is easy... and I mean it's pretty damn difficult. You would be better off writing an engine that loads 3D models and writing a tool that turns height maps into 3D models, if that's what you're aiming for. What are you aiming for?

While I agree that modeling apps give you more control, I don't see where heightmaps make for *physics* problems. I'm using ODE, and have had zero troubles with collision detection or physics using a heightmapped terrain. I just create a Trimesh geom and it works...
Quote this message in a reply
Member
Posts: 36
Joined: 2004.10
Post: #26
Well im trying to make my terrain with the height maps because i have an OBJ loader right now that loads my models. and with that i will load my houses, trees, ect. SO the height map is just for terrain, and if i would have used a 3d model engiene say an OBJ one and loaded my terrain in, it would be reallly slow, because i would have to have lots of polygons, an with heigh tmaps i get a good FPS on my game. SO if you can tell me a way to not make it slow then i might use models, but i am not a good artist so heigh tmaps are easier for me, but if you guys find a way for me that it would not be really slow, then sure i will use 3d models.

thanks
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Finding the height of a point on a given list of vertexes? mikey 10 5,318 Jan 4, 2010 05:36 AM
Last Post: mikey
  Texturing height map problems nahid 6 4,263 Oct 14, 2005 10:24 PM
Last Post: hangt5
  Trouble Calculating Height Field Normals Nick 15 6,202 Jul 21, 2005 07:27 AM
Last Post: Nick