   Heightmap Confusion
  How do you do heightmaps exactly?You have a greyscale image, and you load it.  But how do you load it so it textures fine and stuff?Like I want each tile to have its own texture, rather then putting a whole texture over it.  But how do I calculate the texture co-ordinates?A vertex can''t have the texture co-ordinate of 1.0, 0.0 (if its the right corner of the box to the left of it) and 0.0, 0.0 (the co-ordinate for its own texture).So how do you do that?  The only solution I can think of is to load the vertex 4 times (as it could be the corner to any side) but thats pretty stupid.Please let me know. 
  [Moved to: Graphics Programming and Theory] ;  There are different ways to texture terrain.  One''s to build 1 large texture and use that, anothers texture "splatting" a method I don''t know much about so I can''t help you there or a method which I came across (I haven''t named it but I probably wasn''t the first to think of it.)Basically, you use "n" number of textures like grass, rock, snow and mud.  Each texture''s 128*128 or so big.  Each texture has an alpha texture.  The alpha texture is the same size as your vertex heightmap grid.  So if you''ve got 256 vertices (16*16) you use 16*16 alpha textures.  Each point on the alpha texture represents a vertex in the heightmap grid.The alpha texture is calculated using weights for height and slope and other stuff if you like.Then what you do is stretch the alpha textures over the entire terrain.  Frist thing you do is render the grass and it''s alpha texture.  The clever thing is that you apply a magfilter on the second texture stage (1) which makes the transitions betwen each point much smoother.  This means that when you render it the transition from one type of tile to another is nice and smooth.The only drawback is that you''ve got to do a pass for every texture tile (grass, rock, snow, mud) that you have but you save loads in texture space.  4 128*128 tiles and 4 16*16 (or whatever) alpha textures isn''t very much.Here''s some pictures of it in action in my engine.  It''s a new engine and not much has been done yet.http://uk.geocities.com/oh_so_skillfull/game.htmHope that helpsCYAmatt