I *think* I've got a pretty good understanding of the TERR chunk from looking at Mikademus, and Ghabry's projects.edit: update structure defininations

heightmap data is stored in some form of Block Truncation Coding

The grayscale image is divided into 8x8 sub-blocks each block is represented by two "layers" Layer_1 is a 32-bit value that is used as the base level for all 64 pixels in the block Layer_2 is 64 8-bit values ( one 8-bit value for each pixel in the block ) To determine the height of a pixel the corresponding Layer_2 value is multiplied by 128 then added to the corresponding Layer_1 value

The Layer_2 entries can be re-used by different blocks to save space ( dictionary compression )

All looks great! Using Blender 2.47 I've flattened the original Black Pyramids map B5_01B and included it along with another version with Hills (press B in Blender to group select a region and then raise them up and then smooth them (Alt and Smooth several times) then press F12 to render scene and F3 to save as OpenEXR. Then Save the new modified map as SmoothHill.blend and Export using Dark Omen script as SmoothHill.M3D.

Cool, looks like they've included it in the latest Blender version (does our DO import/Export scripts still work) as I'm still on old 2.47 for using our scripts but can jump between versions if necessary.

« Last Edit: February 27, 2014, 07:54:52 AM by olly »

Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)

Works really well! Troops don't appear to Step down slopes as the gradients are much more smooth using 16bit PNG.

However, just like the earlier height map generator, we need to adjust colour levels down from 255 whiteness to 60 as Blender's white is too high in Dark Omen.

1) Open B5_01B Flat map in blender and create some smooth hills

2) F12 to Render and F3 to Export as 16bit PNG and export as BASE.M3D and convert to BASE.M3X with Map Gridder tool and save as SmoothHills.blend

3)Open new 16bit PNG in Photoshop 7 and lower Colour levels down from 255 whiteness to 60 and flip vertically. Then export as 16bit TIFF and rename to infile. Then using imagemagick to convert back to 16bit PNG using CMD convert infile.tif -depth 16 -type Optimise outfile.png

4)Using command prompt cd and cd choose B5_01B folder to run terr.exe and have the flat map B5_01B.PRJ renamed as in.prj and run the first command terr -x in.prj out1.png out2.png which will extract the existing height maps into 16bit PNG files

5)With the new smooth hills 16bit heightmap, rename it in1.png and copy and paste it again and rename as in2.png . Then run the 2nd command terr.exe terr -i in.prj out.prj in1.png in2.png which will transfer the heightmap data from 16bit png into Dark Omen out.prj

6)Check new out.prj heightmaps but renaming to in.prj and running the first command again to produce 2 new Out.png files

7)Also copy new B5_01B.prj and rename to B5_01.prj to open with BTB editor that also displays heightmap.

I don't trust photoshop to not to screw up the 16-bit color images.... ( and gIMP will screw them up )you should try adjusting the gamma/exposure in blender... but I would think that somehow blender could be setup to make white a certain elevation and black a certain elevation, instead of high is white and low is black.

Quote

You can put a Blend Texture on your mesh, with the ColorBand white on one side and black on the other. In the MapInput tab (on the XYZ blocks) map everything to Z.

maybe?

things don't have to be renamed... in.prj out.png etc. are just descriptions aka this file is PRJ and is INPUT terr -x B5_01B.PRJ weee.png splat.png would work just as well.

Unfortunately all my Mod terrains already have a Blend Texture on mesh, with the ColorBand white on one side and black on the other. In the MapInput tab (on the XYZ blocks) map everything to Z. (Fans only need raise some terrain and then can press F12 to produce height map, as all set up ready to go).

However, I found the solution was to make one terrain tile (or the edges in this test) to be 660 Blender Blocks high which then meant full White = 660 and therefore made 1 Blender Block = 1 Dark Omen block high. Using a modified BTB editor from Ghabry, which displays the heights, it can be used to check values match up. I also rotated the camera 180 so I don't have to flip the height map map vertically before importing.

*More tests to follow and probably my blender settings at fault for 660 to be the work around solution will investigate further as have things like Orthographic Camera Scale set to 313 to fit in whole map etc. but the future is looking awesome*

« Last Edit: March 10, 2014, 12:40:20 AM by olly »

Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)