Skip to main content
GameDev.net gamedev.net
🔒 Locked

Focus On 3D Terrain Programming...?

Started by Jehsup Jul 1, 2004 at 10:39 AM 13 replies 1.9k views
Original Post
Jehsup
Jehsup
Hello all, Does anyone know why none of the heightmaps (the ones generated by the noise functions Trent provides OR ones I build in photoshop..which I know are seemeless) will tile using any of the examples he provides? I know some of the algorithms don't use powers of two heightmaps, but for the ones that do, howcome if I render two tiles side by side there is a gap between them always? Also between ROAM, quadtree, and geomipmapping, is ROAM the only option available for using a power of 2 heightmap? Thanks in advance. J
Jehsup
Jehsup
Noone, bought that book, or just ashamed to admit it? LOL!!!

I wish I hadn't either, I was/am unimpressed to say the least. It's been sitting on my shelf since the day after I bought it about a year ago.

I was just trying to get a quick CLOD terrain system going and noticed that none of the heightmaps he generates or the ones I make in photoshop would tile as 3d rendered terrains.

Every other heightmap example on the net will, but not these.

Anyway....
Promit
Promit
I think that you've misunderstood. I'm not sure what you've misunderstood, as I have no idea what your problem is (you're too vague), but I'm quite sure that you're wrong.

The author is a moderator here, so I imagine he'll post sooner or later. Or you could try to actually explain your problem.


The basic idea behind using a power of two plus 1 is so that the total number of quads comes out to a power of 2 on a side. This is less important for adaptive LoD algorithms which use a bilinear interpolation formula to get the height wherever they want. For geomipmapping, and other patch based algorithms, however, it comes in extremely useful.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
python_regious
python_regious
The book isn't as bad as you made out, though, I wouldn't have bought my copy (and didn't have to), as I knew the material anyway. I too an a little confused as to your problem? You want a randomly generated tilable terrain?
If at first you don't succeed, redefine success.
Jehsup
Jehsup
I hope this is clearer.

1. I Generate a tileable heightmap image(1024x1024)using his midpoint displacement generation function - OK.

2. I Render it in 3D using his rendering code - OK. Nothing altered from any of his original example code to this point.

3. I Render the same heightfield again (the same class instance ), and offset it by map size (1024 in this example) in either the x or z direction so that it sits along side the first. There is always a gap between the two "aligned" edges of the terrain instances. The vertices generated at the edges are never matched up. Not even close.

I get the same result when I create a heightmap in Photoshop (which I know tile seamlessly) and use that instead of generating one using his code.

I get the same result in all his examples from the brute force example all the way through the ROAM2 rendering example. Is this just a floating point resolution problem? Any idea how to get around it?

python_regious
python_regious
Screenshot?
If at first you don't succeed, redefine success.
Jehsup
Jehsup
Screenshot:

Go To

http://www.bestpony.150m.com/screenshot.jpg
WarAmp
WarAmp
Offset by HeightmapWidth - 1.

edit: Or more generally: (HeightMapWidth - 1) * PointSpacing.

edit2: Your webhost there says you can't hotlink that image. So we can't see it.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
python_regious
python_regious
Yeah, you're just offsetting by the incorrect amount.
If at first you don't succeed, redefine success.
Jehsup
Jehsup
It's not the offset, the vertices just don't match up.

My spacing in the screenshot is 1. It's 128x128 terrain block from image of the same size. A vertex for each pixel.

The screenshot shows 128.0 x-offset.
Making the offset (128.0 - 1)* pointspacing has no affect.

J
WarAmp
WarAmp
still can't see the screenshot.

Make a simple index.html page for that site and put the screenshot there.

So you can gaurantee the heightmap is tileable? Like if you load it in a paint program and put them side by side they are seamless?

Sounds like you might have an axis flipped. (exchanged x for y by mistake?)
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
Jehsup
Jehsup
Try it now:

here
WarAmp
WarAmp
The AP is right, you are missing the last row/column of vertices.

for 2 * 128x128 vertex heightmap, you should be rendering 32768 vertices, according to the screen shot, you are rendering 32258 vertices, or 2 * 127x127 heightmap.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
Jehsup
Jehsup
Waramp: That's was it. Thanks for your help. It is much appreciated!!

J

Topic Locked

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

Sign in to reply to this topic.