|
Navigate
|
|
Creating Virtual Textures using VirtualTeX
Draft 1.0 Celestia 1.3.1 Mac OS X 10.3.4
"As I lay in my bed staring up at the stars, I couldn't help but wonder what happened to my ceiling..." author unknown
Virtual
Textures can dramatically improve performance, in terms of frames per
second, on the current version of Celestia on Mac OS X. There are lots
of existing virtual textures available but if you want to make your
own, here is how to do it using Mac OS X.
If you create a good virtual texture be sure to contribute it back to
Celestia Motherlode.
If you are modifing somebodies elses work please check with them first
for permission and to identify appropriate credits and sources.
For the Celestia Motherlode specify that this is a virtual
texture (VT), and specify which levels 0-10 are included. The
corresponding k values can be give in addition to the levels.
Provide a readme.txt
document that provides appropriate credits, usage and copyright
information for you and and the source of your material along with
rights to use. Include installation instructions. Put the readme.txt in the file heirarchy noted below.
These are very basic instructions that require minimal command line interaction.
________________________________________________
1. You will need to download the following tools:
Imagemagick 6.0.0
: A Mac OS X pkg installer for Imagemagick
BBEdit lite
: lite version of the powerful text only editor
GraphicConverter
: view, edit, convert most image formats including .dds
( graphicsConverter does tiling as an option in "Save As…" but begins numbering at one instead of zero. )
Virtualtex
: A shell script that uses imagemagick to convert and identify to create virtual textures.
( use this link then choose "Save As…" from the file menu. Save it in the top level of your user directory. )
2. What to do
Run the "Imagemagick" installer.
It will do a BSD style install and place Imagemagick files in your usr/local/bin directory.
Under Mac OSX these files are invisible and will not be found by the find command unless you
specify that invisible files should be included in the seach.
3. Place Virtualtex in your user folder
4. Open Virtualtex script from BBEdit lite
Turn on "line numbers" in the first pull down menu ( second tool block from the left at the top of the window )
We want to fully quality the path for the "convert" and "identify"
commands in virtualtex so that the script can find them. ( This is not
the only way put /local into the path but is a safe and easy way to do
it. )
5. Make the following changes:
Hard coding the path instead of redefining path avoids a variety of potential
security problems. Particularly for many Mac users who many not be familiar
with their underlying operating system. local:bin is not in the default path.
Please replace <your hard disk name> with an appropriate name.
line 1: #! /usr/bin/zsh
becomes: #! /bin/zsh
line 44: texturesize=`identify $1|cut -d " " -f 3`
becomes: texturesize=`/Volumes/<your hard disk name>/usr/local/bin/identify $1|cut -d " " -f 3`
line 57: convert -cache $maxmem -crop ${tilesize}x${tilesize} $1 out%d.$tileformat
becomes: /Volumes/<your hard disk name>/usr/local/bin/convert -cache $maxmem -crop ${tilesize}x${tilesize} $1 out%d.$tileformat
6. Save the file.
7. Place the image file that you want to convert into your user directory along with virtualtex.
ImageMagick will not tile a .dds format file. Use GraphicConverter to convert to .png before tiling.
8. In your applications | Utilities folder find the terminal application.
9. Open Terminal. It will startup with a tcsh shell by default.
After the prompt type: zsh followed by return to enter a zsh shell.
The style of the prompt will change. Type: chmod +x virtualtex.txt
To define the script as an executable file.
10. At the prompt type: ./virtualtex <texture name> <tile size> <tile format>
For example: ./virtualtex 4kJupiter.png 256 png followed by return, wait a minute.
You should see a list of file names with offsets being created in your home directory.
11. Move all of your textures to an appropriate directory in your Extras folder in Celestia.
This lets you move them easily when you want to update Celestia.
<User Directory>
Library
Application Support
CelestiaResources
Extras
AddOns ( create this folder if you don't have it, zip the parts below this for upload )
< "Name" of your virtual texture >
readme.txt ( contains appropriate credits for you and the source of your material )
< name.ssc >
textures
hires
< name.ctx >
name
level0
tx_0_0.jpg
tx_1_0.jpg
level1
level2
12. Write an appriate .ssc and .ctx file to go with your texture. More Info on Celestia Textures
Celestia only has one alternate texture active so if you name all of
your virtual textures "DefaultVT" in the .ssc file then when you select
this as your alternate texture all of your virtual textures will be in
place. For example: AltSurface "DefaultVT" "Sol/Earth"
13. Open Celestia, Select the object that your VT is for, control-click and select alternate texture.
Your new texture should appear on you sub menu for you to select.
____________________________________________________________
Additional Notes:
Generally tiles are square and there are twice as many wide as there
are height to map a planet. The general formula for the effective
height of a virtual texture level is: TileSize*2^(Level + BaseSplit)
You
can add higher resolution in a very small area by including only the
tiles that correspond to that latitude and longditude. "Jim" Jens wrote
a spreadsheet to calculate the latitude and longitude boundaries for
tile images. You can download it from Shatters.net at
http://www.shatters.net/~jim/files/VT-tile-calculator.zip. The
spreadsheet was written for Excel but should work with OpenOffice, too
ref -- Selden Ball
There are always twice as many tiles horizontally as vertically.
So, level 0 would be 2 1k x 1k tiles, level 1 would be 8 tiles, level 2 32 tiles, etc.
ref. --Chris
level 0:
+--+--+
| | |
+--+--+
level 1:
+--+--+--+--+
| | | | |
+--+--+--+--+
| | | | |
+--+--+--+--+
Level 0: 2 Tiles
Level 1: 8 Tiles
Level 2: 32 Tiles
Level 3: 128 Tiles
Level 4: 512 Tiles
Level 5: 2048 Tiles
Level 6: 8192 Tiles
Level 7: 32768 Tiles
Level 8: 131072 Tiles
Level 9: 524288 Tiles
Level 10: 1048576 Tiles
Thanks to Dr. Fridger Schrempp for the "VirtualTex" Script, Bob
Hegwood for "Virtual Textures for Dummies", Selden Ball for "Creating
Textures for Celestia", and the many contributions of those
contributing to Celestia forum: Virutal Textures
and the Celestia forum in general.
Chris and all the various developers for continuing to make Celestia a reality, and Hank and Co. for making
the Mac OS X version happen.
Disclamer: The author disclaims all liability and endorsement.
Copyrights may apply :: folkstone.ca © Scott Bleackley V0N 1V1
Folkstone Design does not endorse and is not responsible for the content of external sites.
External links will open in a new window.
|
|