I'm Back. And I apologize

Grom

22-06-2007 01:05:49

I got a job! And lost a whole lot of free-time in the exchange. I haven't been around the boards lately, and I had some stuff I was going to share.

Namely, the PLSM2 stuff I have. Here's the thing; I don't want to download the latest NxOgre or Ageia stuff. ( I am stubborn. And its frustrating to see stuff not work that I'd already spent so much time setting up ) The code I have requires some minor alterations (additional constructors) to NxOgre.

What I'd really like is for someone (someone like betajaen, optimally) to assimilate my code into their latest-version stuff, and to help me write a Wiki on how to use it (I've never made a wiki on this site and would like clear instruction on how to do it. I'm well versed in HTML/Javascript/CSS etc) We could use some chat medium.

The problem still exists that your physics shapes can fall off the edge of the surrounding heightmaps. The more I think of it though, the more I realize that its job specific to different engines. So I'll leave it to the end user to decide how to handle that.

Sorry for dashing off like that!

betajaen

22-06-2007 09:17:58

Welcome back!

Your job is more important anyway. I'd be happy to look at your code. We've made some progress in heightmaps whilst you've been away.

I've attempted to write some code (which half works) to read 8 and 16-bit RAW images, for super smooth heightmaps. There is two nasty bugs with it though; first the image is rotated 180 degrees (probably due how RAW works) and the second after a certain height the terrain is dropped below the terrain; like if their was a sudden change and the terrain just dropped but kept it's original shape.

The second one is possibly the code that will take over the "Paging Terrain Crown" from PLSM, HexiDave's Simple Paged Terrain. Who has written the Physics code with NxOgre. I also believe he's solved the falling off the moving pages bit you have.

Hopefully with your code for PLSM and HexiDave's we should have everything covered for the next batch of games featuring massive worlds.

HexiDave

22-06-2007 15:15:50

My ears are burning....

Let's see if I can help you out with the heightmap problem.

First, the 180 flip: instead of reading height (i.e using a getHeight(x,y) function) and placing it in nxOgre as row,column, try (rowSize-row-1, rowSize-column-1) and, if that's still flipped wrong, try (rowSize-column-1, rowSize-row-1) to flip it on the other axis. Basically you're just flipping the read/write order. You, of course, could just flip the loop around, but you get the idea.

As for the crazy spikes in the terrain, that's just the value rolling over the bit-depth. For instance, a signed short has values from -32768 to +32767 (this is your NxI16 for height values) and you try to place value 32768 into it - you'll get -32768 instead because it's rolling over. So, if I remember your code, you multiply the height value your getting from the Image data color by 32768.0f, you're breaking it over the limit of a signed short when you convert it.

For falling off moving Pages, I'm not sure what's going on there. Any Page that's alive in my demo using nxOgre builds a collision mesh and it sticks with that Page wherever it goes. I didn't think that PLSM2 had a floating origin system, so if you're getting things dropping off Pages in PLSM2, it's probably because the collision mesh got destroyed.

Grom

22-06-2007 23:11:04

The thing with falling off pages is that I don't technically use the pages of the PLSM2 terrain, just the height data. I split the entire map up (at full resolution) into a grid of heightfield shapes (with user-determined dimensions) and save them to the disk. Then at runtime I load the 9 heightfield shapes immediately surrounding the camera. So if you have a box that you rest on the terrain, then move far away enough, the box will fall through the terrain as the heightfieldshape beneath it disappears. If you then move forward again, the box will register that it is far below the surface, and will shoot skyward violently with impossible rebound force.

HexiDave

22-06-2007 23:24:07

Shouldn't you be using PLSM2's listener functions to just tell you when a Page is built and then load the corresponding data?

Grom

23-06-2007 02:05:00

why? that's a whole lot of calculations to be done at runtime. Why do that when I can just precalc?

HexiDave

23-06-2007 02:55:57

I said load, not calculate :P Load it with the Page it's on - you should have a naming convention similar to the textures and such to auto-load your pre-cooked collision meshes with the Page using the listener functions.

I think the old OgreNewt/PLSM2 integration code is still in the wiki for it on how to load baked items with a Page; you could use that for a base or something.