Terrain LOD pop-in is horrible

Blitz3D Forums/Blitz3D Beginners Area/Terrain LOD pop-in is horrible

IcyDefiance(Posted 2009) [#1]
OK, so I'm not new to the BlitzBasic coding language, but I never got very good at the 3D aspect before moving on to some web development languages. Now I'm back and working on a small FPS just for the practice it'll give me.

Anyway, my problem is that the terrain is morphing a lot, even when it's very close to the camera. When I increase the TerrainDetail, it seems to morph less, but it gets very rough when viewing it from very close. The best median I could find was 6,000, and the pop-in might be slow enough that people won't notice, once I slow down the camera to the speed that people will be moving once I put characters in the game, but the roughness is still horrible.

Here's the code handling the terrain:

Global ground = LoadTerrain("terrains/temperate_HM.jpg")
TerrainDetail ground,6000,True
ScaleEntity ground,1,200,1


Terrain is 1024x1024 px, supposed to represent 2km of distance. Generated with L3DT, I've tried using jpg, png, and bmp files, but there's little to no improvement with any of them. I could always save it as .3ds or .x or something, but I really would like to keep the polycount down as far as possible if I can.

Camera moves at a rate of 2 units per frame. Frame rate is regulated at 62 fps, and it achieves this easily on my computer.

Here's a screenshot of the roughness:



Here's the heightmap if it helps: http://i457.photobucket.com/albums/qq291/Yippee2393/temperate_HM.jpg


Beaker(Posted 2009) [#2]
Have you tried applying a blur to your heightmap (2 pixels worth maybe?)?


IcyDefiance(Posted 2009) [#3]
Yeah. I even went overkill and did a 10px gaussian blur, and it didn't make any noticeable difference. So I don't think it's a problem with the heightmap itself.


Yasha(Posted 2009) [#4]
Have you considered something like this?

http://www.blitzbasic.com/Community/posts.php?topic=84809

As far as I know nobody really uses Blitz terrains for this reason and many others. If what you want to achieve can be done with a mesh, I would strongly recommend that you do use a mesh.


IcyDefiance(Posted 2009) [#5]
OK, I bookmarked that link to look through when I find the time.

And yeah, I guess I'll have to use a mesh.

Thanks for your help.

EDIT: Problem #2

Global ground = LoadMesh("terrains/temperate/temperateTerrain.b3d")
groundTEX = LoadTexture("terrains/temperate_TX.jpg")
EntityTexture ground, groundTEX




I've had this same problem with other meshes, but terrains, planes (such as the water in that screen that needs to be repositioned...), and the other odd thing here and there work perfectly. Why? And what can I do to get the texture to do something besides making my terrain green?


Matty(Posted 2009) [#6]
Looks like UV coords aren't set for that green terrain.


MikhailV(Posted 2009) [#7]
@Yippee: Don't use JPEG format for heightmap! Lossless only - PNG, BMP.


IcyDefiance(Posted 2009) [#8]
@Matty: That's my first thought, but if L3DT exported it and didn't give me any options about UV coords, you'd think it would work with a texture exported from the same program... Meh, I'll try exporting as *.x or something.

@MikhailV: I know quite a bit about images, a whole lot more than I do about 3D game programming, and a JPEG compressed to 95% quality is just as good as a PNG or BMP for just about anything. This is no exception. There's a couple things, like screenshots from games like RuneScape that you plan on using transparency on, that PNG's work better, but not many.

Of course, if I saved it in Paint (which compresses to 85% quality), that would make a difference, but I didn't. It was exported with L3DT, which compresses to 95%.

Besides, I already stated that I already tried using PNG and BMP, and it made no difference.

EDIT: Oh, crap, I export as *.x instead, and load it into the program and it doesn't even appear. It exists, because I can handle it without errors, but it's invisible, or too small to appear, or in a different location...

EDIT 2: All right, I spend a couple hours figuring out that BlitzTiles thing, re-exported my terrain 1 unit bigger in .ter format, etc, and it works perfectly. Thanks for your help, everyone.


John Blackledge(Posted 2009) [#9]
"As far as I know nobody really uses Blitz terrains for this reason"

I hate comments like this.
Blitz terrains are highly optimised and I've used them in all my products.
Mesh terrains caused an immediate frame loss.

You just have to tweak/play with all the settings.


IcyDefiance(Posted 2009) [#10]
Thanks, John, but I did tweak all of the settings I could find and I couldn't get it to work right. I know it can work right if done right, but I really like this BlitzTiles and it made things just that much easier once I got the code I needed in there.


Naughty Alien(Posted 2009) [#11]
you do understand that B3D terrains are 8 bits only?


John Blackledge(Posted 2009) [#12]
Naughty, he's talking about LOD pop-in.
That's a permanent feature of Blitz, but he'd like it optimised.


grindalf(Posted 2009) [#13]
I found that 1024x1024 terrains ALWAYS have a lot of pop in
I always reduce the heightmap to about 256x256
and you can always up the terraindetail.


D4NM4N(Posted 2009) [#14]
a JPEG compressed to 95% quality is just as good as a PNG or BMP for just about anything.
not entirely true, especially when you need 100% accurate color values for heights, masks etc. Jpeg will still dither slightly even at very high quality.


fox95871(Posted 2009) [#15]
Call me a jerk for saying anything bad about Blitz3D, but I decided a long time ago to never use heightmaps when I saw the pop in problems it has. It might take a little longer to make things in Maya, but then there's never any pop ins, which is well worth it I think.

If you really like heightmaps though, I did notice once that shrinking everything often makes things much more accurate in general because then it's all in the low decimal range, or it's all closer to 0,0,0... something like that. I never tested it on pop ins, but it worked great for Driver when the wheels were falling through the mesh at the far extents of a bigger landscape I made for it.

http://www.blitzbasic.com/Community/posts.php?topic=85855#972247