www.quadsoftware.com
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic
 A way to rotate terrains after they are created. « View previous topic :: View next topic » 
Author Message
plasticacorn
PostPosted: Wed Apr 23, 2008 4:46 pm    Post subject: A way to rotate terrains after they are created. Reply with quote



Joined: 27 Feb 2008
Posts: 7

Hello. Smile


I was hoping there is an easy way to rotate terrains and their associated texture/heightmaps and opacity maps after they have been created. I need to rotate my terrain 90 degrees clockwise and re-export it.

Thank you in advance.

-plasticacorn.
Back to top
View user's profile Send private message
ALicu
PostPosted: Wed Apr 23, 2008 5:10 pm    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1326

Hello,

One solution would be to export it to 16 bit raw for example (using the default plugins, like General Large Data Sets exporter), rotate the raw image (in an external program like Photoshop) and import the geometry back.

Another solution, if you are a programmer, it is pretty easy to create an utility plugin that is called from the Grome menu and rotates the heightmap values and textures for the selected zones. In the Grome SDK you have access to all the terrain data (geometry, images etc).

In the future we plan to add a special tool to cut and past terrain from one location to another and also apply transformation to them (rotate , scale etc).

Regards,
Adrian L.
Back to top
View user's profile Send private message
plasticacorn
PostPosted: Wed Apr 23, 2008 5:18 pm    Post subject: One last try. Reply with quote



Joined: 27 Feb 2008
Posts: 7

Hello Again Smile,

Thanks for the awesome response time.

I got the heightmap out and rotated in photoshop no problem, but the major problem I'm having is the opacity map. If I save out the .png again it somehow munges the file and makes it so it doesn't work anymore.

Do you have any suggestions as to a graphics utility that would allow me to rotate it?

I guess I'm trying to have to avoid starting over. I've re-imported the heightmap onto a blank terrain and am ready to launch into repainting the textures.

Thanks again.
Back to top
View user's profile Send private message
ALicu
PostPosted: Wed Apr 23, 2008 5:25 pm    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1326

Hi,

Can you post screenshots (one before and one after) of the incorrectly transformed images (I'm assuming you refer to terrain color or mask images). Also what importer are you using? RAW importer with one jpg image as input?

Thanks
Back to top
View user's profile Send private message
plasticacorn
PostPosted: Wed Apr 23, 2008 8:15 pm    Post subject: Some screenshots Reply with quote



Joined: 27 Feb 2008
Posts: 7

Hi,

Screenshot of opacities and what the results are. (One is GROME but it looks pretty much identical in TGEA.)

http://i295.photobucket.com/albums/mm130/plasticacorn/plasticacorn_screenshotA.jpg

Transformed opacity:

http://i295.photobucket.com/albums/mm130/plasticacorn/MilRangeOpacity.png

Original opacity straight out of exporter:

http://i295.photobucket.com/albums/mm130/plasticacorn/tgea_masks.png

I guess what I am looking for is can you seen any quantifiable difference between the two .png files that could account for the weird behavior that is being exhibited in the TGEA screenshot.

again- the only difference between the .png files is the transformed .png is rotated 90 degrees clockwise and re-exported out of photoshop. I tried exporting it with the standard photoshop exporter as well as an older version of the superpng plugin available on the Garagegames site. (this was used when using Freeworld to generate Atlas opacity maps by hand back some time ago.)

Thank you so much in advance.

-pa.
Back to top
View user's profile Send private message
ALicu
PostPosted: Thu Apr 24, 2008 7:00 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1326

Hi,

I've looked over the image and basically Photoshop destroys (set them on white) the channels that are behind transparent pixels. From a visual point of view there is nothing wrong with that (putting invisible pixels on white makes the file a lot smaller which is the point of compression for web formats). But we want normalized channels (red+green+blue+alpha = 255), putting white (red=green=blue=255) where alpha is 0 is no good.

Now, the problem is that PNG was not meant to represent colors like this (don't know why GarageGames choose this format over others). PNG it is always RGB and has or not a transparency channel. This transparency channel is not considered alpha so that's why Photoshop decides that where there is full transparency the color information doesn't matter.

Now, this is the technical explanation. I've managed to find a solution for this (maybe there are some simpler but I had to use the tools I have). In total commander I press F3 to view the image, then right click on it, save as and choose bitmap (BGRA bmp). Luckily for us the total commander viewer transforms the transparency to alpha in this conversion. The rotate the bitmap (you can use photoshop or other program) and save also as bitmap. All the information is preserved. Then in Faststone viewer I save the bmp back into png (this viewer is the only one I found to transform the alpha back to transparency status in PNG). You can find the file here:

http://www.quadsoftware.com/storage/tgea_masks_rotated.png

Now another solution would be to write a simple C program to do the rotation on the PNG directly (using libpng).

Also another solution would be to operate on the initial map data. This is actually much better since you will have the correct map in Grome. For this you need to save the layer masks with text exporter or general data exporter for example. Then you have greyscale images for masks. Rotate each. Also export the heightmap as raw and rotate the raw image too. Finally, after rotations, you need to import all the data back. You can create a new scene, import the raw with raw importer. Then add the layers on the terrain again (manually add them). Assign the same textures. Now, to not paint the terrain again just click on the mask thumbnail in the selection layers list and select the masks you've exported. This should work and you will not have to paint the masks again.

Regards,
Adrian L.
Back to top
View user's profile Send private message
plasticacorn
PostPosted: Thu Apr 24, 2008 5:17 pm    Post subject: Thank you. Reply with quote



Joined: 27 Feb 2008
Posts: 7

Adrian,

Thank you for the variety of approaches. Smile

I always feel more at ease when I understand exactly what is happening.

Your valuable time is so appreciated.


Very Best Regards and Thanks Again,

-Shane
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Based on a template by Dustin Baccetti
Powered by phpBB © 2001, 2005 phpBB Group