Game Development Community

16 bit raw / photoshop problems / new terrain

by Kip Carr · in Torque Game Engine Advanced · 06/03/2005 (10:38 am) · 7 replies

I didnt know exactly where to post this but it has to do with the new terrain and i figured that is the big topic now.

I was trying to import some data i had from a terragen file to raw but after that i wanted to play with it in Photoshop 5.5 some (dont have the newest :( ). The reason i wanted to mess around with the .raw file was because where i wanted my lakes and rivers wasnt deep enough in the raw so i was going to darken the color and lower those areas. Well i created a new psd file and used my texture as a screen to select where the water was going to be. Used the magic wand and presto I have an outline of my area where i want my water to be. Well then i go to copy the raw grey image over so i can modify it and save it back to the raw format. This is where my problem comes in. First you cant modify the 16 bit image so you have to change it to 8. Then once i was done i wanted to save my new raw file out to a 16 bit image.

Photoshop doesnt save in 16 bit raw data!!!!!

Does anyone know a fix to this? How are we to modify the raw data or anything if we cant save out to the format that the conversion needs for Torque.

My second question has to do with the scaling of the raw format in the function call. I used Daylon Leveller for my conversion from terragen to .raw and that works great. When i convert it ask what the min and max heights are for my .raw file. Well i put in the information. Now i need to know how do i get the scale to match that. Say my terrain goes from 80 meters to 124 meters in hieght. This is a difference of about 44 meters. Do i need to do the scale so that 1/x * 65534 = 44 ??? this way i would get the exact scale that i want or would that mess it up? I guess I need more information on what exactly this scale is.

#1
06/03/2005 (11:53 am)
Figured out the photoshop problem. I need a new Photoshop. If anyone knows a plugin that i could use that would be great so that i dont have to go spend the money for a new PS.
#2
06/03/2005 (12:59 pm)
Gimp

Does everything Photoshop can do excluding vector art and to top it off it's completely free software. Not exactly what you were looking for but it certainly does the trick for me.
#3
06/03/2005 (1:05 pm)
I'm using PSP9, which is just as brain-dead on the various forms of .raw. It can read them all, but it will only output in 8bit. However, Terragen will import an 8bit, and then reexport it as 16bit Intel. It's a pain, but a little back and forth action is working great so far.
#4
06/04/2005 (6:17 am)
If you open a 16bit image exported from terragen and change it and save, it saves in 16 bit intel, works perfect to use with the atlas terrain. then you can just copy and paste the hightmap you want to the 16 bit image, flatten and save. atleast in photoshop cs.
#5
06/06/2005 (4:08 am)
Yah CS seems to have 16 bit support but not much else. I was hoping to not have to go back and forth between programs a lot. I guess i can try downloading Gimp and seeing if that has the 16 bit support for this. It is free so that is nice.

Still no one knows about the second question on terrain heights?

UPDATE: GIMP does not seem to support the raw format at all.
#6
06/07/2005 (6:56 pm)
The RAW file just stores integers from -32767 to +32767 (or 0 to 65535, depending on when you look at it). So, the vertical scale factor is crucial because it allows you to map from that range to something meaningful (ie, torque meters).

Your guess at the scale factor sounds about right.
#7
06/08/2005 (10:16 am)
Ben can you be a bit more specific on that point about guessing the scale.

So we know that a raw stores ints from 0-65535 or the signed version. If i change the scale down to 1/256 to get 256 different hieghts does this now mean that it will take the 65535 different colors and group them into 256 different heights?

If this is correct then the following should be right???

say i want 80 meters of height for a raw file:

65535/x = 80 x = 819.1875

so my scale factor should be 1/819.1875 to get exactly 80 meters of variance for the heightfields?

Does the bottom number for the scale have to be a power of 2, that is all i have seen in the examples???


Update:

If i try any number for the bottom that is > 256 i get a crash. I dont have the console stuff with me at the moment but I believe it was something along the lines of "empty bin". I tried powers of 2 and just whole numbers "300" or things like 302.5864 but nothing worked over 256.