World Machine Community

News and Development => Bug Reports and Help => Topic started by: Helen on November 17, 2003, 08:32:33 am

Title: From POV-Ray to WM?
Post by: Helen on November 17, 2003, 08:32:33 am
Hi,

I have made a heightfield in POV-Ray and wanted to import it in World Machine.
POV-Ray, for some strange reason, accepts - among others - "heightfield" 16bit red/green TGAs (that WM ouputs), but can only make 16bit grayscale PNGs and PPM files as heightfields.
I have been unable to find a suitable converter of 16 bit PNGs or PPMs to ... anything. Is there such a beast?

TIA

Helen
Title: From POV-Ray to WM?
Post by: Fil on November 17, 2003, 10:15:04 am
Hi Helen,

I believe you can use photoshop or some other programs to convert to 24 bit color TGA..  Ignore the fact that its black and white information and save it as if it would be a color image. I think this works..

Yup,  8) it does work! I tried it with a printscreen :D LOL

There was a nicely detailed discussion on the subject on the yahoo worldmachine group some time ago, but I don't remember very well when..  Oshyan, can you help me on this?
Title: From POV-Ray to WM?
Post by: Anonymous on November 17, 2003, 01:41:04 pm
Quote from: FilHi Helen,

I believe you can use photoshop or some other programs to convert to 24 bit color TGA..  Ignore the fact that its black and white information and save it as if it would be a color image. I think this works..

Yup,  8) it does work! I tried it with a printscreen :D LOL

There was a nicely detailed discussion on the subject on the yahoo worldmachine group some time ago, but I don't remember very well when..  Oshyan, can you help me on this?


Hi Fil,

Yes, it can be opened with a graphic editor, but as an 8 bit grayscale image. (My graphic editor says it is a 32 bit image opened in 24 bit) It only has 256 shades of gray if saved as a 24 bit TGA and not the 65 or so thousand of the original. Terragen terrains are 16 bit.
An 8 bit grayscale (as are most image formats in the grey channel) has visible steps and is not smooth.
That is why I used POV-Ray to make the model and export the heightfield. Unfortunately it does not export a 16 bit heightfield in any of the formats World Machine recognises. It exports a 24 bit TGA, with 8 bits in the grey channel, which is accepted by WM, but the detail of the 16 bit is lost.

I was thinking more of heightfield converters, since the format is only used for heightfields, but haven't found any.

As for the YahooGroups WM discussion, I don't seem to remember it and I can't find it. The nearest I came was about acceptable 8 (24) bit TGAs and Oshyan's mention of the lack of good 16 bit editors.

It was interesting browsing over old messages in the WM group - thanks for the tip :)

Helen
Title: From POV-Ray to WM?
Post by: Fil on November 17, 2003, 01:49:51 pm
Oh, sorry Helen, Your're right!!

I forgot about 3*8=24 bit... so the 24 bit only has 8 bit of usable "greyness".. I keep forgetting that!..

I remember now we talking about photoshop having limit editing functionality of 16 bit greyscale in the group.. and it has to be saved on raw format I think.. So there's not much of a solution here for you

Sorry if i missled you!..

Cheers,
Title: From POV-Ray to WM?
Post by: Fil on November 17, 2003, 01:57:44 pm
:idea: I feel an idea comming :idea:

I just had an idea.. you need a a 16bit PNG to "any_WM_file" converter right? If I remember correctly 24bit color PNG format is quite straight-forward to read from.. I might have a look at making a small aplication that converts that.. I just need to know what is most simple to to write to that WM is able to read.. I also need to find some time to do it, so don't expect anything from me before the end of the week :(
Title: From POV-Ray to WM?
Post by: Helen on November 18, 2003, 08:36:27 am
Quote from: Fil:idea: I feel an idea comming :idea:

I just had an idea.. you need a a 16bit PNG to "any_WM_file" converter right? If I remember correctly 24bit color PNG format is quite straight-forward to read from.. I might have a look at making a small aplication that converts that.. I just need to know what is most simple to to write to that WM is able to read.. I also need to find some time to do it, so don't expect anything from me before the end of the week :(


I am impressed and speechless ...

Thank you.

Helen
Title: From POV-Ray to WM?
Post by: JavaJones on November 18, 2003, 09:41:08 pm
Helen, if you can give me a sample file to work with, I may be able to work out an existing translation path with free or cheap apps. You can post it somewhere, or e-mail me (oshyan AT earthlink DOT net).

- Oshyan
Title: From POV-Ray to WM?
Post by: Anonymous on November 18, 2003, 10:09:02 pm
Quote from: JavaJonesHelen, if you can give me a sample file to work with, I may be able to work out an existing translation path with free or cheap apps. You can post it somewhere, or e-mail me (oshyan AT earthlink DOT net).

- Oshyan


Hi Oshyan,

Sent. Hope you have better luck than me.

Helen
Title: From POV-Ray to WM?
Post by: JavaJones on November 19, 2003, 12:44:51 pm
Unfortunately it does not seem like I am having such luck. :-( Very stubborn this format is. I can bring it into Photoshop, then convert to Grayscale 16 bit, then save as RAW, then bring into Leveller, then export as .ter. But Leveller isn't free, nor particularly cheap. I tried Firmament's 16bit import, but it doesn't seem to work. It's possible that some playing with the .raw export options in Photoshop would fix this. But Firmament has always been a bit wonky in my experience.

What we really need is a utility solely created for the conversion of various terrain formats. 3DEM is kind of like that, I suppose. But it focuses mostly on DEM formats. We need something that can read in any 16+bit graphics format - PNG, TIFF, IMG, etc. and then output DEM, .ter, etc. Anyone up for the challenge? Leveller can do a lot of this, but again it's not free.

More experimentation...

Ok, woohoo! SUCCESS! Here's what you do: as above, take your .png into Photoshop. It should load no problem. Then go up to the Image menu, choose Mode, and set it to Grayscale, and confirm "Discard color information". Then Save As in TIF format.

Then get the latest version of 3DEM from here (http://www.visualizationsoftware.com/3dem.html). Load 3DEM and go to File, Load Terrain Model. Choose "GeoTIFF DEM (.tif)" and then browse and select your file. It will tell you "Incorrect Corner Coordinates" and then pop up a box with lots of data to enter manually. Leave the data format and offset alone (INT 16, no offset). In Matrix Dimensions, put the size of your image (257x257 in this case), make sure the data order is "Little Endian". Put the coordinate system to X/Y.

Finally (for the import step), in the SW/NE corner coordinate area, just put in some standard value. I used 10000 for the NE corner, for both values. That seemed to work fine. Since it's not really a DEM we're importing, this part doesn't matter except to tell it that there will be some distance between one corner and another, but this value is in meters (unless you specify otherwise), so if you actually want to specify something else at this point, you can. It will be the total size of your terrain in each dimension. You should be able to scale it later in Terragen to fit whatever you need anyway.

Last step in 3DEM, go to File and Save Terragen Terrain, and probably Entire Terrain. The terrain comes out inverted, and Terragen doesn't have an Invert function. But WM does! So then bring it into WM, put down a File Input and an Invert device, and you should finally have your terrain. A bit of a long and convoluted process - certainly unnecessarily so. But it works! :D After that you'll need to adjust it in Terragen with vertical scaling and point spacing, probably, but that shouldn't be too hard. Hope that helps! :)

- Oshyan
Title: From POV-Ray to WM?
Post by: Helen on November 19, 2003, 02:02:20 pm
Thank you Oshyan,

I will need to study it carefully, before I try it :-)

Helen
Title: From POV-Ray to WM?
Post by: Helen on November 25, 2003, 02:32:40 pm
I need to set the record straight.

POV Ray does output a 16 bit red/green TGA, of the same format that WM outputs, but does not read. It is only set through a different command than the file output one ( hf_gray_16 on  in global_settings in the POV file and +FT in the command). I just found it :-(
Searching for readers of the POV-Ray TGAs, I came upon Terrasculpt. It reads them, and converts to TER, but, since it is a rather old program, only reads up to 257X257 pixels.
Then today, after having updated Terragen to the new version, I checked the Firmament menu and it reads POV-Ray 16 bit red/green TGAs. I swear I had not noticed this before. I tested it and it works.

So the way to go from POV-Ray to WM is to export a heightfield TGA, import in Terragen through Firmament, save as TER and import into WM.

Thank you all for your ideas and sorry for misleading you.
I hope this info will be useful to someone.

Helen