ROAM and Height mapping

Can anyone please direct me to a pure Java3D ROAM and/or height mapping example?

Many thanks.

IIRC, j3d.org has a ROAM implmentation. For a simpler heightmap, lookup my DRTS-project on sourceforge.

Ok Herkules, I decompiled SimpleHeighmap.class from your DRTS project.(Hope thats ok)

I understand everything until i got to this part


private static Raster getHeightRaster(Image image, int i)
{
        int j = image.getWidth(null);
        int k = image.getHeight(null);
        int l = j / i;
        int i1 = k / i;
        BufferedImage bufferedimage = new BufferedImage(l, i1, 10);
        bufferedimage.createGraphics().drawImage(image, 0, 0, l, i1, null);
        return bufferedimage.getData();
}

I searched around the Java Docs and couldn’t find the method for this


bufferedimage.createGraphics().drawImage(image, 0, 0, l, i1, null);

I know your drawing the image and then retrieving the Raster from the bufferedimage but can you explain the variables that

drawImage(image, 0, 0, l, i1, null);

takes?

Also what is the variable i, and why is j and k, the width and height being divided by it?(See code)


int l = j / i;
int i1 = k / i;

Another question, how would you go about creating a the terrain from the info you get from the Raster? Would you input the height info and stuff into a QuadArray?

Thanks.

You don’t have to decompile since you can download the sourcecode from CVS.

For now, I cannot explain in detail whats going on (and I personally haven’t written that code).

Basically the heigthmap data is split into tiles, and for the tiles geometry is created. IIRC its a TriangleStrip.

In the game, view range and fog are adjusted to the size of the tiles, so that most of them are culled away.

This article covers the basics of height maps and terrains: (JDJ Sept 2004) http://sys-con.com/story/?storyid=46231&DE=1. It does not cover texture mapping or tesselation like ROAM. There is another article that includes creation of terrain from external files including photos with texture mapping here: (JDJ June 2004) http://www.sys-con.com/story/?storyid=45087&DE=1. Both include documented source.

Hope this helps.

Mike

Thanks Mike, Herkules, the info you gave me was really useful. I’ll post any questions when i run into some problems.