Terrain smoothing/LOD query

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
IainC
Posts: 27
Joined: Tue Feb 24, 2004 5:55 pm
Location: Aberystwyth, UK
Contact:

Terrain smoothing/LOD query

Post by IainC »

Hi all,

Popping aside, the terrain LOD in demo 12 is pretty nice.

I'm having trouble getting the LOD to work correctly when using heightmaps larger than 256 x 256 though.

I want to load a 1024 x 1024 heightmap, scaled (1, 1, 1). It looks great at further-away distances but when very close to the terrain (nearest or 2nd-nearest LOD) the terrain becomes very blocky, as though the other LODs are interpolating between vertices correctly but the closest LOD isn't.

Has anyone experienced this or found a way around it? I'll post a screenshot if I'm not making myself clear.

Many thanks for any help.
www.coldcity.com|ninjastyle
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

make 4 512x512 blocks instead..

have them load when in range for optimization..

if thats even possable.. seems logical.. shrug. :roll:
IainC
Posts: 27
Joined: Tue Feb 24, 2004 5:55 pm
Location: Aberystwyth, UK
Contact:

Post by IainC »

That may help if the issue was memory utilisation... In any case, I don't have any better results using 512 x 512, and it just seems a lot effort to get a paging loader on the go when I should be able to find the right tweaks to make this work... anyone got any ideas? :(
www.coldcity.com|ninjastyle
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

can you post a screenshot, or email me a screenshot, so i have a better idea what you're talking about.
Image
IainC
Posts: 27
Joined: Tue Feb 24, 2004 5:55 pm
Location: Aberystwyth, UK
Contact:

Post by IainC »

Spintz,

Here's some 1024x1024 terrain that illustrates the problem. The top and bottom shots show the same terrain at two different LODs.

Image

The top looks great, and you can see from the wireframe that it's interpolating between vertices nicely.

The bottom is the closest LOD, and shows the stepping effect I'm trying to get rid of.

Any ideas? I'm not scaling the terrain at all.
www.coldcity.com|ninjastyle
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

This is a problem with the heightmap. Others have had this problem and it was always caused by a bad heightmap.

My best guess would be that this happens when you resize a heightmap in a picture editor. For instance, when I use Freeworld3D to generate my heightmaps, it's smooth, but if I resize the heightmap in IrfanView or Photoshop, it comes out with those kinds of jagged edges. If you want to alter the heightmap, do it in a proper terrain editor or resize the terrain by scaling it in Irrlicht.
Image
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

oh thats what he was talking about...

yeah that makes sense most image editors optimize and blend colors in strips like that.

good work spintz

nice screenshots btw wish i could produce something like that.


AWSOME is that for the zombie thingy? sweeet 8)
IainC
Posts: 27
Joined: Tue Feb 24, 2004 5:55 pm
Location: Aberystwyth, UK
Contact:

Post by IainC »

Hi guys,

Thanks a lot for taking a look.

The wierd thing is that I'm just exporting the heightmap from the terrain editor I'm using (the wonderful L3DT). I tried exporting as a JPG instead of a BMP and the problem was lessened to some extent but was still evident.

Will try a different editor and compare results - really want to use L3DT :(

Midnight: Thanks :D Yup, it's for the GameDev zombie thing - KNEW I should have disabled my zombies before taking the screenshot :D
www.coldcity.com|ninjastyle
zenoid

Post by zenoid »

I'am using Pnp-TerrainCreator which look good but was not succesful importing BMP from it. I've tried different rendering scale but I always have this stepping issue at ground level. Is it due to the way the editor do the BMP, the rendering technic, or something else ?

Any help appreciated.

ps I'am using irrlicht + newton

thx
IainC
Posts: 27
Joined: Tue Feb 24, 2004 5:55 pm
Location: Aberystwyth, UK
Contact:

Post by IainC »

zenoid - same result here :(
www.coldcity.com|ninjastyle
zenoid

Post by zenoid »

I've just tried L3DT which I didn't know before. Looks good but I have the same result. In my app, I scale the terrain up because of phy engine necessity but anyway nothing compare to the smoothness of the original tut heightmap.
IainC
Posts: 27
Joined: Tue Feb 24, 2004 5:55 pm
Location: Aberystwyth, UK
Contact:

Post by IainC »

Hmmm - posted on the L3DT forum and got this response:
Hi Iain,

The bitmap exports are only 8-bit greyscales, so what you're seeing is
the 256 steps in altitude. The only way to fix this problem, as far as
I know, is to use a format with a greater precision, such as 16-bits
(TER, BT, HFF, PGM, RAW) or 32-bits (BT, HFF, X). If you have another
preferred format, I'll be happy to add it to my 'to-do' list.

Cheers,
Aaron.



--- In L3DT_users_group@yahoogroups.com, "SNIPPED"
<SNIPPED> wrote:
> Hi all,
>
> With reference to a thread on the Irrlicht forum:
> http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=45261
>
> I'm having trouble getting L3DT heightmaps to load nicely in Irrlicht.
> Has anyone seen a similar problem when using L3DT terrain exported as
> a .BMP heightfield?
>
> I really, really want to use L3DT for my project so I want to make
> sure I can get a usable workflow.
>
> Many thanks for any help anyone can offer.
>
> Best,
> IainC
Does this sound correct, Spintz?

I would have thought that the 8-bit values could still be interpolated between, as the more distance LODs seem to do?

Or am I missing something? :oops:

To test further I manually made some heightmaps with the airbrush tool in a range of programs - Photoshop, Graphics Gale and MS Paint - and I still can't get rid of the stepping, even on what I'm sure are pristine bitmaps.

JPGs behaved better - the steps are smaller (due to the greater bitdepth as Aaron suggests?), but still present, which makes me think I need to tweak the terrain scene node to get it interpolating nicely, but I haven't dived in there yet.
www.coldcity.com|ninjastyle
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Yes, that's your problem. Although in the editor the terrain looks smooth, if it's only exporting 8 bit greyscale images, you have only 256 levels of height available. So let's say you have terrain with a delta of low/high height of 512 units. the bitmap generator for the heightmap will round values out to make the heightmap fit into the 256 units, so unit 0 and 1 would be 0, 2 and 3 would be 1, etc.

Try generating a terrain that doesn't have a large height difference between then lowest and highest points and see what happens.
Image
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

zombies are too cool to hide :P :twisted:
EricDB
Posts: 8
Joined: Wed Nov 09, 2005 1:47 am

Post by EricDB »

Sorry to resurrect an old thread, but I found this with a search, and it still seems to be an issue. I got around it by generating a 1024^2 heightmap, exporting it (as 256 colors), and upping the color depth to 16M, then resizing it down to 256^2 in Paint Shop Pro using Smart Size, which interpolated the colors.

It seems to have worked okay. Is there a better solution?
Post Reply