Page 1 of 3

virtualtex script help

Posted: 12.07.2007, 00:30
by Ozark
If anyone can give me a hand, I am trying to run the virtualtex script on an Image i created in Photoshop. I have followed all the instructions in the dummies guide. But whenever i run the script on an image i get this error message in CYGWIN:


Ozark@home ~
$ cd ../..

Ozark@home /
$ virtualtex test2k.png 256 png
identify.exe: unable to open image `test2k.png': No such file or directory.
identify.exe: unable to open file `test2k.png'.
identify.exe: unable to open image `test2k.png': No such file or directory.
identify.exe: unable to open file `test2k.png'.
identify.exe: unable to open image `test2k.png': No such file or directory.
identify.exe: unable to open file `test2k.png'.

Texture size = x tilesize = 256
Number of tiles = 0
Image format of tiles: png

Tile:

convert.exe: unable to open image `test2k.png': No such file or directory.
convert.exe: unable to open file `test2k.png'.
convert.exe: missing an image filename `out%d.png'.

Ozark@home /
$
any help would be very very welcome. :?

Posted: 12.07.2007, 01:16
by selden
The error messages are saying that the png image files are not in the current default directory.

What directory contains the image files?
What directory contains virtualtex?

Posted: 12.07.2007, 01:50
by Ozark
Seldon,

Thanks for responding so quickly!

According to "dummies pdf" the directory for images to be split is :
C/Cygwin/home/Ozark. The directory for the virtualtex script is in C:/Cygwin/usr/local/bin. Is this correct or am i mistaken?


Ozark

Posted: 12.07.2007, 10:16
by selden
That sounds right. C/Cygwin/home/Ozark is your "home" directory: the default directory when you start bash. The shorthand for that is ~

Your Cygwin bash startup script sets its prompt to display your current default directory. Your current default directory needs to be the directory where the images are. What you show above is that you started out in ~ (where you needed to be) but then you did a ../.. for some reason, which put you in (= changed your current default directory to be) Cygwin's root directory (/). The script can't work after you do that.

Posted: 12.07.2007, 10:53
by t00fri
Ozark,

the rule is simple. After virtualtex is located correctly in /usr/local/bin of your CYGWIN installation, you just change to the directory, where your texture is located. In your case, it's your home directory, hence just type 'cd'. Then you call virtualtex IN THAT directory like you did before

$ virtualtex test2k.png 256 png

Bye Fridger

PS: Note in UNIX/LINUX the following commands are all equivalent:

$ cd /home/Ozark
$ cd
$ cd ~
$ cd ~Ozark

Try it out...

Homework: where do you go with the two successive commands

$ cd
$ cd ..

Check it by typing

$ pwd

which always prints out the name of the directory you are in.

Then do

$ cd -
$ pwd

AHA!

Next try

$ cd /
$ pwd

then again

$ cd -
$ pwd

AHA! ;-)

Posted: 12.07.2007, 19:06
by Ozark
Good Afternoon Gentlemen,


Okay so here is where i'm at :


Ozark@home ~
$ virtualtex

Usage: virtualtex [--help | <texture name> <tile size> <tile format>] [e|E|w|W]


The shell script 'virtualtex' is a tool for Celestia > 1.3.0
that supports 'virtual textures'.

The script generates the required tiles tx_i_j of desired (square) size,
<tile size>, in a specified format, <tile format> = png, tga, jpg,...,
from an input texture, <texture name>, in any popular graphics format.

The optional 4th argument e|E|w|W is for the case of tiling
square /e/astern | /w/estern halfes of the full texture separately!

Besides Linux/Unix, the script also runs in a current Cygwin installation
under Windows, ( http://www.cygwin.com ). If the z-shell ('zsh') is unavailable,

it also may be executed with the 'bash' shell, by replacing #! /usr/bin/zsh by
#! /bin/bash in the first line.

The script assumes that a recent version (>= 6.1.8) of the ImageMagick package
( http://www.ImageMagick.org ) is installed (either under Unix/Linux or Windows)
.
The utilities 'convert' and 'identify' of that package are used.

You may increase the pixel cache size $maxmem from the 80 MB default
value to e.g. 80% of your RAM size within the script with an editor.
This will speed up the performance of 'virtualtex' considerably.

On a PIII/512MB RAM the tiling of a 16k x 8k texture into
32 (2k x 2k) tiles now only takes 15 minutes with a Linux OS!

Author: Dr. Fridger Schrempp, fridger.schrempp@desy.de
Version: 1.04, 02/15/05


Ozark@home ~
$ virtualtex test2k.png 256 png

tilesize = 2562048
/usr/local/bin/virtualtex:51: bad math expression: illegal character: ^M

Ozark@home ~
$


I ran it without changing the prompt this time and got the above message.


the reason i did change the prompt the first time was because i'm not familiar with Cygwin. When i installed image magik, to test the display it had me change the prompt to "/" also according to "dummies" when installing netpbm it also had me change the prompt to " /" : then type a line of code (i'm guessing to activate, register or just see if the install went right for netpbm.)so i assumed that was what i was supposed to do . (my mistake)

Now i understand that those instuctions were givin long ago and may be a bit out of date, so my question is givin that new versions of all the programs are out perhaps i did not install them correctly, although imagemagik, cygwin, and the virtuatex script seemed to be installed correctly, But netpbm I'm not so sure there were so many downloads and packages to to choose from. I chose the one I thought most relevant. netpbm-10.27.exe a self intalling windows version. But when i ran the bit of code from "dummies"

[color=blue]:5) Type ?€?cd ../..?€

Posted: 12.07.2007, 21:08
by selden
"tar" is a program to extract files from an "archive" (sort of like a .zip file). The tar archive file contains files in specific directories.

You need to 'be in' the root directory (that is, Cygwin's directory which is named "/") so that when tar needs to recreate some of the directories which it contains, they're created in the correct places relative to the other Cygwin directories that already are on your system.

(For example, some netpbm distributions will need to create the directory /usr/local/bin/netpbm. /usr/local/bin usually already exists, so just the subdirectory netpbm will need to be created. If you tried to run tar while you were in your home directory, it would create /home/Ozark/usr/local/bin/netpbm, which is not what you want.)

However, you can put the tar archive file anywhere (so long as you remember to move it someplace more appropriate after you've finished the installation). If you want to type just the name of the file and not have to type the name of the directory that it is in, then the tar archive file has to be in Cygwin's root directory (/), too.

The error message
tar (child): netpbm-10.18-cygwin-1.3-bin.tar.gz: Cannot open: No such file or directory

is saying that the tar archive file is not in your current default directory, which is the root directory (/).That means either you should move the tar archive file to / or you should type the name of the directory where you put the tar archive file. If you put it in your home directory, for example, then you could use the command

Code: Select all

tar xzf ~/netpbm-10.27-cygwin-1.3-bin.tar.gz

(Recall that ~ is shorthand for your home directory)

Posted: 12.07.2007, 22:22
by Ozark
Hello!

Okay when Netpbm was installed it installed into a folder called GnuWin32 in the Cygwin root directory. I havent been able to find a "xzf tar archive file" or anything called "tar archive file"

Posted: 12.07.2007, 22:35
by selden
Now you've confused me.

In your earlier post you said you were trying to install netpbm by using the command

Code: Select all

$ tar xzf netpbm-10.27-cygwin-1.3-bin.tar.gz

"netpbm-10.27-cygwin-1.3-bin.tar.gz" is a tar archive file. That is indicated by the ".tar" in its name.

Posted: 12.07.2007, 22:50
by Ozark
He :? He sorry for the confusion. Your not the only one.

Now i understand that those instuctions were givin long ago and may be a bit out of date, so my question is givin that new versions of all the programs are out perhaps i did not install them correctly, although imagemagik, cygwin, and the virtuatex script seemed to be installed correctly, But netpbm I'm not so sure there were so many downloads and packages to to choose from. I chose the one I thought most relevant. netpbm-10.27.exe a self intalling windows version. But when i ran the bit of code from "dummies"


I thought once netpbm was installed THEN you run the "dummies" Tar xzf command (in cygwin) to get cygwin to recognize netpbm. At the time i did not know a "tar" file was an archive file and I did not know the tar xzf command for dummies was an installation command.

So then with the self installing Netpbm file i shouldn't even have to run the "tar xzf" command from "Dummies" is that correct?

Posted: 12.07.2007, 22:52
by selden
If you want to use netpbm in conjunction with Cygwin, you shouldn't be installing the Windows version of netpbm, nor should you be using tar. As the netpbm home page points out, netpbm is one of the many sets of programs which are installed by using Cygwin's package selection program. (currently netpbm 10.33-1)

You can use either the Windows or tar versions of netpbm with Cygwin, but making either of them work properly in Cygwin's environment is not a project for the novice. You need to be very familiar with both Windows and the Unix command-line environment.

Posted: 12.07.2007, 23:04
by selden
One of the problems is that the "Dummies" documentation was written quite some time ago, and its author is no longer involved with Celestia at all :(

Posted: 12.07.2007, 23:09
by Ozark
All i am trying to do is to get the virtualtex script to work. I have tried to follow the directions spelled out in the Dummies pdf guide. If there is a current method for getting the script to work I would love to hear about it. However the guide is all i can go by and the Netpbm is the only portion of the instructions that i am having a hard time with. I would really like for it to be as simple as the guide suggests. Do i even need Netpbm to run the script?

Posted: 12.07.2007, 23:27
by selden
Hopefully Fridger will correct me if I'm wrong, but as best I can tell, virtualtex doesn't make use of any of the netpbm utilities. It uses ImageMagick utilities instead. Bob mentions this in the "Addendum" at the end of the Dummies text.

I'm not sure why Bob recommended installing netpbm, although I personally find it convenient to use both ImageMagick and netpbm utilities when I'm doing various image manipulations. I find the netpbm commands somewhat more natural than IM's, but that's probably just me.

Posted: 12.07.2007, 23:37
by Ozark
Seldon,


Thank you for all your help it has been very informative. :)

I'll try uninstalling netpbm and see if i get any results without it.

Posted: 13.07.2007, 00:32
by Ozark
Well i tried the script without netpbm.
the directory for the images to be split is c\cygwin\home\ozark
the directory for virtualtex script is c\cygwin\usr\local\bin
and this is the result:


Ozark@home ~
$ virtualtex test2k.png 256 png

tilesize = 2562048
/usr/local/bin/virtualtex:51: bad math expression: illegal character: ^M

Ozark@home ~
$


Im not sure what that error message means so i don't know what to change.

Posted: 13.07.2007, 01:42
by bdm
It looks like the script is saved with a PC file format (CRLF) instead of a Linux file format (LF only). Try removing the CR (^M) from the end of each line.

Posted: 13.07.2007, 02:06
by Ozark
Hello BDM,

I was searching the net earlier and came across a post by Fridger,
and he had mentioned the same thing when someone else was getting
a similar(though not the same) error. He suggested editing the file with a non windows based editor such as Nano, which i have to no avail. When
i went to look at the script, nowhere did i find a line ending with ^m. Just a note: in order to get the script it has to be saved as a text file and then remove the .txt extension.


Thoroughly confused

Ozark

Posted: 13.07.2007, 06:58
by t00fri
With my latest version (1.04) there might be a problem in some cases as to its collaboration with ImageMagick that is needed. Unfortunately, ImageMagick frequently has bugs in their releases. They should test more thoroughly before releasing new ones...

Try version 1.03 which has been successfully used by many and even works with the default bash shell instead of zsh.

http://www.celestiaproject.net/~t00fri/virtualtex_1.03

Which version of ImageMagick did you install??
Did you install the 'zsh'?

Good luck,
Bye Fridger

Posted: 13.07.2007, 20:04
by cartrite
I was dealing with a similar problem about a year ago.
http://www.celestiaproject.net/forum/viewtopic ... 9789#79789
Hope this helps.
cartrite