Author Topic: 8bit BMP grayscale to raw.  (Read 5522 times)

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
8bit BMP grayscale to raw.
« on: April 03, 2017, 03:13:33 PM »
Can PS convert\save an 8bit grayscale to the raw format used as the height.raw file? I have CS2 and it opens the TE height.raw files.

I just need to draw a circle on a 4096x4096 bitmap and have it turn into an "18 sector diameter, 25k high ring 1\8 sector wide" when I import it back into the TE.

I'm testing an assumption from the 6 months building my first terrain. 
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline Greebo

  • Skinner Team
  • Platinum Member
  • ******
  • Posts: 7019
Re: 8bit BMP grayscale to raw.
« Reply #1 on: April 03, 2017, 04:14:22 PM »
I managed to edit the raw height map using a free program called Krita, which can be found at: http://www.krita.org/

It was a bit of a caper to get it to work though:

To load the height file open Krita, hit "File/Open" and navigate to the folder the height map is in. In the open file window change the "All supported formats" filter to "All files". Click on your height map file and hit "Open". This brings up a "Choose Filter" window with a list of formats. In this list select "r16 heightmap" and hit "OK". This brings up a "Heightmap Import Options" window, set the size to "4096" and the button to "PC" and hit "OK".

When you are done editing it save the file as an r16 heightmap. This gives the file an "r16" suffix. Once this is edited manually to "raw" the TE loads the file successfully as a signed height map.

The only slight issue with the program is that it displays the file rotated 90 degrees to the right. This is no big deal though as it only takes a few seconds to rotate it left to match the TE orientation for editing and then back right again before saving.

IIRC I was able to create a height map in PSP, save it as a bmp, open it in Krita and then save it as an r16 file, edit the suffix to raw and open it in the TE. Like I said, a bit of a caper.
« Last Edit: April 03, 2017, 04:25:18 PM by Greebo »

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: 8bit BMP grayscale to raw.
« Reply #2 on: April 03, 2017, 04:25:43 PM »
Yes Photoshop can save out to raw. You just need to do few things  to do so if you are doing it. I am on the road so will to try to write some up later but it is how I did nebrit and work on blades before ah make map so as was update for AH3 for doing historical terrains.
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: 8bit BMP grayscale to raw.
« Reply #3 on: April 03, 2017, 04:25:59 PM »
About the 2nd month, having in the first month used a copy of the CBM to grid walk cutting the gross outlines for the land, then making almost 200 CBM to see what I was doing. I thought I remembered someone's conversation I read in here about how to use a grayscale bitmap and convert it. If that were possible, I could draw one "gross" copy and import it to create the "gross" terrain and tweak from there. I was never attempting to create something that looked like a 20x20 piece of the European continent. Just some place for people with limited time each evening to find and whack each other quickly.

I'll give Krita a look, and thank you.
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: 8bit BMP grayscale to raw.
« Reply #4 on: April 03, 2017, 04:27:00 PM »
Yes Photoshop can save out to raw. You just need to do few things  to do so if you are doing it. I am on the road so will to try to write some up later but it is how I did nebrit and work on blades before ah make map so as was update for AH3 for doing historical terrains.

Looking forward to it.

I started wondering what the Pac terrain set looks like from the TE perspective.
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: 8bit BMP grayscale to raw.
« Reply #5 on: April 03, 2017, 04:36:33 PM »
Greebo,

The PSP bitmap, what bit did you save it as? 8, 16, 24, 32?
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline Greebo

  • Skinner Team
  • Platinum Member
  • ******
  • Posts: 7019
Re: 8bit BMP grayscale to raw.
« Reply #6 on: April 03, 2017, 04:44:55 PM »
It was over a year ago I did this so I can't remember the format now, but it was probably 24 bit. PSP can't save 32-bit bmps.

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: 8bit BMP grayscale to raw.
« Reply #7 on: April 03, 2017, 04:46:04 PM »
In Kira I can "paint" with assistants which is the equivalent of tools menu in other art programs. Can I just build my 4096x4096 in Kira as a grayscale, then save in the r16 format?

And just in case, a 24bit bitmap, got it thank you.
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: 8bit BMP grayscale to raw.
« Reply #8 on: April 03, 2017, 05:20:01 PM »
I am am on the road this week and then in Europe the rest of the month. What I remember off the top of my head is:

1) Stay in Grayscale
2) It should be 16 bit
3) It is an EXTREME pain to try to edit height elevations in raw.

It is best to basically just use it to set water and the land shapes. For a -signed- raw file I believe had the value of 254,254,254 (rgb) and land of 1 ft I think was 1,1,1 rgb. But I don't have my notes  with me to say that 100% certainty. So I would say create a 4096x4096 8bit grey scale file. Do all my work in it  and then change the image index to 16bit, flatten the layers, AND then remember to flip it vertically. For some reason the TE when imports the file has a different orientation. If you think of top of the image as North once in the TE imports the image it actually comes out as being South.

Sorry can't say more I don't have my notes with me and actually I let AH Make Map do most of my work now in this regard since I basically do historical maps.
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline Greebo

  • Skinner Team
  • Platinum Member
  • ******
  • Posts: 7019
Re: 8bit BMP grayscale to raw.
« Reply #9 on: April 03, 2017, 05:25:26 PM »
I imagine you can create a height map in Krita. Personally though I'd rather be creating than figuring out how to create so it was easier for me to make a height map in PSP, then export to and from Krita to get it in the correct format for the TE.

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: 8bit BMP grayscale to raw.
« Reply #10 on: April 03, 2017, 07:41:20 PM »
I just want land and water defined without my having to go through 200+ CBM a few changes at a time working by braille. If the "height.raw" imported will cause the TE to produce the raw landscape, it is worth some gyrations since I can use the art program tools to quickly create a single master land element in grayscale.

Though ultimately you can use a CBM as a trace template by editing it in an art program with the land masses, then painting in the land with the 6mile diameter brush and connecting the dots. I would "sculpt" the land by hand anyway, and got very fast at it after building all of those fjords and mountain ranges by hand on my terrain. I think I sculpted and touched up about 50,000 miles of terrain by the time I got done. Some of it several times because Hitech wanted the white textured dolomite rock.

Having a master raw terrain file to create the land masses and then a master finished to scale project art file copied from the land mass file to use as my blueprint for object placement is the goal to cut out the middleman of 200+ CBM bmp files. I was always amazed at how I could think a tiny bit of land added or subtracted while looking at that area from 50,000ft above in the TE was overkill when I ran the build and tested the change offline. Online a 1mile x 1mile area is huge sitting in the middle of it in a tank or creating a sea passage between islands.   
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: 8bit BMP grayscale to raw.
« Reply #11 on: April 03, 2017, 08:00:29 PM »
Greebo,

Krita allowed me to create a project in grayscale 16bit integer/channel 4096x4096 from Krita internal selections in the project setup menu. Do you think that is what the r16 format will be that you used then changed .r16 to .raw for import into the TE? The latest version of Krita has a tools menu bar which gives me the tools I'm familiar with in Paint.Net where I created the AH3 gunsights.

-Update-

My bad, I can save in *.r16 Heightmap or *.r8 Heightmap "format". So Greebo, Krita allows you to make heightmap files for terrains in grayscale.

This is the format I chose for my current 4096x4096 .r16 project file, or is there a better format to import into the TE?

Model: Grayscale/alpha
Depth: 16bit interger/channel
gray built in (default)
« Last Edit: April 03, 2017, 08:29:27 PM by bustr »
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline Greebo

  • Skinner Team
  • Platinum Member
  • ******
  • Posts: 7019
Re: 8bit BMP grayscale to raw.
« Reply #12 on: April 04, 2017, 02:11:15 AM »
You'd probably need to direct those sort of questions at HT or Ghostdancer, my only interest in Krita was as a transfer medium between PSP and the TE and once I got that to work I didn't dig any further. At the time the idea was to test the AH3 TE by building a new MA terrain from scratch and I managed to build a new height map in PSP, transfer that to the TE, put fields on it and so on. After that I shelved the terrain and concentrated on modifying CraterMA to AH3 spec.

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: 8bit BMP grayscale to raw.
« Reply #13 on: April 04, 2017, 07:54:16 AM »
The r16 is good but he difference between r16 and r8 is that in r8 (I assume is 8 bit) grayscale is that you have 256 shades of grey and white and black. In r16 (16 bit (gray scale) it displaces colors on screen as grey. So true red (255,0,0 rgb) will display as grey. So be careful doing your elevations in the raw file. Since the height map actually uses more than 256 color I believe.

In AH2 you would set a max elevation for the map and then each of the 254 colors in between black and white represented a step in feet. Basically divide the elevation by 254 to see what each color shift equaled to in feet. New AH3 doesn't work that way and I forget what exactly the the foot difference between each shift in color equals. I do remember I thought it was a pain so went in and did rough shapes in there and then in the TE fine tuned elevations.

Also shorelines will end up blockier in than in AH2 you will need to go work on splining the shorline once you import the raw file.
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline Greebo

  • Skinner Team
  • Platinum Member
  • ******
  • Posts: 7019
Re: 8bit BMP grayscale to raw.
« Reply #14 on: April 04, 2017, 08:49:33 AM »
I did some digging in the beta TE thread. The height.raw file is in 16-bit signed format. This gives around 32,767 land height variations going from black as 0 ft to mid grey as 32,767 ft. Then for ocean white represents 0 ft sea level going up to mid grey as 32,767 feet deep ocean floor. However I seem to recall the TE treats any negative value below 1K as 1K depth.
« Last Edit: April 04, 2017, 08:51:48 AM by Greebo »