Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Addons > Addon Development
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Addon Development Developers post news, updates, & discussions here about your projects in development.

Reply
 
Thread Tools
Old 01-21-2019, 08:54 PM   #1
galleto
Orbinaut
Question Very high resolution texture conversion problems.

Hi, I'm trying to make a cloud map for the earth out of a 43200X21600 texture, and afaik first I have to convert it to a .tex file, and then convert that to a .tree file.
The problem is that the pltex converter for whatever reason only accepts .bmp images, which seem to have a limit of 30000X30000 pixels so whenever I try to convert my raw file to a 43200X21600 bmp it just makes a corrupt mess (I have tried irfanview, gimp and photoshop).
Then I found out that there is another program, texbuild that accepts other formats but it crashes before finishing:

Building .tex...
Traceback (most recent call last):
File "texbuild.py", line 239, in <module>

File "texbuild.py", line 186, in main
buildtex(outfn, fmt, level)
File "texbuild.py", line 231, in buildtex
tmpfile.close()
IOError: [Errno 2] No such file or directory: 'out\\dds\\tex_0.dds'


and besides it only seems to reach level 8 mipmaping so that does not really suit me.

So I guess my question is, how can I convert my image to a .tree file readable by orbiter 2016 with the maximum tile level available?

thx.
galleto is offline   Reply With Quote
Old 01-22-2019, 12:01 AM   #2
Donamy
Beta Tester


Default

I believe Orbiter only accepts square textures, although I could be wrong.
Donamy is offline   Reply With Quote
Old 01-22-2019, 08:23 AM   #3
jacquesmomo
Kourou CSG addon Developper
 
jacquesmomo's Avatar
Default

Quote:
Originally Posted by Donamy View Post
 I believe Orbiter only accepts square textures, although I could be wrong.
I think you're absolutely right. The problem is probably this....
jacquesmomo is offline   Reply With Quote
Old 01-22-2019, 08:56 AM   #4
GLS
Addon Developer
 
GLS's Avatar
Default

I think the sides must be a power of 2.
GLS is offline   Reply With Quote
Old 01-22-2019, 02:26 PM   #5
martins
Orbiter Founder
Default

A couple of things:

* use of pltex is no longer recommended, since it produces the outdated .tex format. It is better to use plsplit64 instead, which generates the current quad-tree texture format. You mentioned that you planned to convert .tex to .tree. Is there actually a tool that does that?

* the input image files must be a power of 2. If it isn't, you have to interpolate up or down using your favourite image processing program.

* For global coverage, the source image must be twice as wide as it is high (except for levels 1-3, see below). with a longitude range of -180 (left edge) to +180 (right edge) and latitude range from -90 (bottom edge) to +90 (top edge).

* BMP does indeed have a limit of 30000 x 30000. Even if you find an image processing tool that generates BMP beyond that, it isn't standard and won't be properly processed by pltex or plsplit64.

* To solve this, you have to split the source image into subimages (just two in your case - western and eastern hemisphere) and process them separately. Both pltex and plsplit64 can do that.

* If you use plsplit64, it involves slightly more work
- you need to generate interpolated source images for each resolution level from 1 up to the max resolution supported by your source file. In your case, this involves

Level 1: 128 x 128
Level 2: 256 x 256
Level 3: 512 x 512
Level 4: 1024 x 512
Level 5: 2048 x 1024
Level 6: 4096 x 2048
Level 7: 8192 x 4096
Level 8: 16384 x 8192
Level 9: 32768 x 16384

plus level 10 if you decide to interpolate up from your source image.

- plsplit64 then needs to be run for each of these resolution levels, providing the correct interpolated image. For Level 9, you will have to split the image into 2 parts and process both of them, providing the correct boundaries in the command line parameters. If you process Level 10, you will have to split the image into 4x2 sub-images and process all of them.

- plsplit64 generates the quadtree in a directory structure with a separate file for each tile. If you want to compress it into a single .tree file, use the texpack utility.

More detail may be found in Doc\PlanetTexures.pdf.


Edit:

So much for the basics. Now for the interesting stuff: For cloud maps, it might be worth trying to implement an adaptive resolution approach. While there will be areas with high detail that benefit from high resolution textures, it will be wasted in other areas. In particular for large cloudless regions there is obviously no reason to subdivide a node further if the parent is already entirely transparent. Similar for large uniformly cloud-covered areas.

So you could try the following: generate the entire quadtree up to resolution 10. Then do an FFT of each of the highest resolution tiles. If their high-frequency content is below a given threshold, delete that tile. If all four children of a parent node are deleted, recursively process the parent as well. This way you would get a cloud texture map that retains all the interesting high-resolution bits, but saves significantly on file size. A cool project or what?
martins is offline   Reply With Quote
Old 01-22-2019, 09:24 PM   #6
galleto
Orbinaut
Default

Quote:
Originally Posted by martins View Post
 A couple of things:

* use of pltex is no longer recommended, since it produces the outdated .tex format. It is better to use plsplit64 instead, which generates the current quad-tree texture format. You mentioned that you planned to convert .tex to .tree. Is there actually a tool that does that?

* the input image files must be a power of 2. If it isn't, you have to interpolate up or down using your favourite image processing program.

* For global coverage, the source image must be twice as wide as it is high (except for levels 1-3, see below). with a longitude range of -180 (left edge) to +180 (right edge) and latitude range from -90 (bottom edge) to +90 (top edge).

* BMP does indeed have a limit of 30000 x 30000. Even if you find an image processing tool that generates BMP beyond that, it isn't standard and won't be properly processed by pltex or plsplit64.

* To solve this, you have to split the source image into subimages (just two in your case - western and eastern hemisphere) and process them separately. Both pltex and plsplit64 can do that.

* If you use plsplit64, it involves slightly more work
- you need to generate interpolated source images for each resolution level from 1 up to the max resolution supported by your source file. In your case, this involves

Level 1: 128 x 128
Level 2: 256 x 256
Level 3: 512 x 512
Level 4: 1024 x 512
Level 5: 2048 x 1024
Level 6: 4096 x 2048
Level 7: 8192 x 4096
Level 8: 16384 x 8192
Level 9: 32768 x 16384

plus level 10 if you decide to interpolate up from your source image.

- plsplit64 then needs to be run for each of these resolution levels, providing the correct interpolated image. For Level 9, you will have to split the image into 2 parts and process both of them, providing the correct boundaries in the command line parameters. If you process Level 10, you will have to split the image into 4x2 sub-images and process all of them.

- plsplit64 generates the quadtree in a directory structure with a separate file for each tile. If you want to compress it into a single .tree file, use the texpack utility.

More detail may be found in Doc\PlanetTexures.pdf.


Edit:

So much for the basics. Now for the interesting stuff: For cloud maps, it might be worth trying to implement an adaptive resolution approach. While there will be areas with high detail that benefit from high resolution textures, it will be wasted in other areas. In particular for large cloudless regions there is obviously no reason to subdivide a node further if the parent is already entirely transparent. Similar for large uniformly cloud-covered areas.

So you could try the following: generate the entire quadtree up to resolution 10. Then do an FFT of each of the highest resolution tiles. If their high-frequency content is below a given threshold, delete that tile. If all four children of a parent node are deleted, recursively process the parent as well. This way you would get a cloud texture map that retains all the interesting high-resolution bits, but saves significantly on file size. A cool project or what?
Yes, the map I wanted to generate for orbiter 2016 is a global cloud map, I forgot to mention that. It is basically NASA's next gen blue marble but corrected and filtered in photoshop so it looks more detailed up close. I have the cylindrical projection in double wide than tall, so scaling it to powers of 2 won't be a problem.
Another thing is that I didn't know of the plsplit 64 tool (I need to read the documentation in detail), I was trying to use the treeman tool I found in another post so it should be easier this way.
The FFT definitely sounds worth the time, I don't really have the skills to automatize that but maybe I can select the mostly empty ones with an action in photoshop and remove them.

Thank you for the detailed response, i'll see what results I get.
galleto is offline   Reply With Quote
Thanked by:
Reply

  Orbiter-Forum > Orbiter Addons > Addon Development


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 09:22 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.