Skip to main content

Loader for binary format

7 replies [Last post]
henrp
Offline
Joined: 2006-02-17
Points: 0

Hello,

I am writing a loader for Terragen's .ter files, a landscape generation program. The file format contains an elevation grid, and the height values are given in 16 bits unsigned integers.

My problem is that the loader interface specifies that I must use a Reader in the load() method. And a reader can only read chars... the int read() method, as far as I understand it, first convert the 1 byte ASCII char to 16 bits Unicode, and then to int. it works fine for some values but not for some others (e.g. a binary value of 1000 0000 (128) gives 172... and 0000 0000 gives 32...)

Has anybody any suggestion how I could retreive the true values ?

otherwise, I will forget this method and use only the load(String filename) and load(URL uRL) methods, where I'll be able to use a byteStream instead of the Reader... Does any body know why the API forces the use of a Reader ? I guess Terragen isn't the only binary format around ?

By the way, is anybody interested in such a loader ? I develop it as part of my diploma work but I'd be glad if it can be useful to others...

Pierre Henry

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
damonmalas
Offline
Joined: 2006-08-06
Points: 0

I heard itd be very hard to work with a gaint obj. I might try the BMP option in FEO. Ill give it a shot while studying the landscape thread. Thanks a bunch.

Rolf Gabler-Mieck

java3d-interest@javadesktop.org schrieb:

>I heard itd be very hard to work with a gaint obj.
>
hi

no not really, if you change the lineend in that what you wish - or if
you directly working on a MAC - absolute no problem,
the onliest thing is as said that there's a true square-grid structure
which will be more clever
sorted by the vrml.ElevationGrid.Node either the ESRI-ASCII-Grid.
because the define the grid in the header and so no
right and depth-values are necasarry, only the hight, field..but during
the loading all wents into triangle again....
could be awfull for loading such an obj-file over the web, because it is
4-times bigger then the vrml or esri-grid of the same surface...

>I might try the BMP option in FEO.
>

will also be possible to turn it into an RASTER and then into any
Geometry, but I am unsure how many bits that export offers...
could be interesting for accurancy, e.g if it is an 8-bit greyscale.bmp
and you have (had...) data from sealevel up to Himalay with
a meassured hight-accurany of 10m.... then you need ~900 colors [better
1800!!]...not only 256

if the goal is to develop something for "only" virtual/artifical
Landscapes produced by Terragen then the accurancy-need should
not be the highest priority...
anyway I am very interested in your work, to combine tg with j3d, a plan
I gave up a few years ago [because of less time...],
maybe think about loading a .ter-file direct !
ter-file is an open file definition at planetside and many
software-products offers the option to export in .ter- format directly.
In my eyes the most best idea...
good luck at all
rolf

> Ill give it a shot while studying the landscape thread. Thanks a bunch.
>[Message sent by forum member 'damonmalas' (damonmalas)]
>
>http://forums.java.net/jive/thread.jspa?messageID=156666
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>
>
>
>

--
Dipl. Ing.(FH) d. Geomatik
Rolf Gabler-Mieck
c/o
LGI-Geographisches Institut der CAU-Kiel
Ludewig-Meyn Str. 14
24098 Kiel
Tel: +49 431-880.2955
FAX: +49 431-880.4658
e-mail: gabler.mieck@geographie.uni-kiel.de

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

damonmalas
Offline
Joined: 2006-08-06
Points: 0

>maybe think about loading a .ter-file direct!

Im thinking about it. It seems do able.

damonmalas
Offline
Joined: 2006-08-06
Points: 0

I dont suppose anyone has a terragon loader by now would they?

Rolf Gabler-Mieck

java3d-interest@javadesktop.org schrieb:

>I dont suppose anyone has a terragon loader by now would they?
>[Message sent by forum member 'damonmalas' (damonmalas)]
>
>

If you're using the FEO-Plugin for terragen you can export an obj, which
is readable by j3d,
maybe you have to eliminate/change the MAC Lineendsign into that of your
choice.
the obj-"grid" file iwhich you get from terragen has also X and Y
values, so a bit bigger than
needfull. But it works
regards
rolf

>http://forums.java.net/jive/thread.jspa?messageID=156203
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>
>
>
>

--
Dipl. Ing.(FH) d. Geomatik
Rolf Gabler-Mieck
c/o
LGI-Geographisches Institut der CAU-Kiel
Ludewig-Meyn Str. 14
24098 Kiel
Tel: +49 431-880.2955
FAX: +49 431-880.4658
e-mail: gabler.mieck@geographie.uni-kiel.de

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

henrp
Offline
Joined: 2006-02-17
Points: 0

Ok, never mind my post, Ill just throw an IncorrectFormatException in this methos and use the other two...

pierre

jjones7947
Offline
Joined: 2004-10-16
Points: 0

Didn't think the loader format was that restrictive. You can use one of the load methods that returns a scene or scenebase object. Would be interested in seeing the loader is you don't mind.
Jim