vSky 0.1a release

PC related discussion and other issues.

vSky 0.1a release

Postby vcool on Sat Dec 12, 2009 8:19 am

Image


Hello there Interlopers, it's time for me to unveil my rather small (but big) creation.

vSky automates your VMT creation process when making skyboxes. Those who tried, know, that it involves copious amounts of copy/pasting and you're always bound to make a stupid type somewhere. With LDR skyboxes you only need to work with 6 files, but with HDR it becomes 12-18.

So yes, it should make your life simpler.

It's fairly intuitive to use, and there's more info in the readme file in the distributive. (I can write a small tut if anyone wants, but really, it is as straightforward as it can get.)

Speaking of the distro. It's big. It's 5 MB compressed and 20 MB unpacked. :( :smt021 I am very sorry it is so large, but it's a Python quirk when making EXEs. I outlined the reasons in the readme, but I'll paste it here:
Python is an interpreted high-level language, which
in layman terms means it's very easy to code with, but it isn't as fast as the
nightmare of all beginner HL2 coders (talking about C++ here) nor is it as fast
as Java, even. There are some plugins like PsyCo which supposedly speed up
computing, but luckily for the distributive size, I have utterly forgotten about
it. Otherwise I would include it and this would bloat to another 5 MB.

Anyway, since Python is an interpreted language, it also means that you need
to have Python installed on your computer. Otherwise there is nothing to inter-
pret your files. There are numerous tools, however, that will compile your code
into an executable which we all love since all we do is double click on it. The
problem with that is every library you use, you have to include it with your
compiled exe. As such, py2exe - the tool I used to compile this code, includes
all sorts of PYD's which are dynamic python libraries and compiles all sorts
of DLLs in order for the exe to run. Since I made a fancy GUI for this program
it had to include the user interface library which I used (Qt) and as you've
noticed, it's pretty large.


So yes, it's large but like with all software, you either use it or you don't. If I brush my C++ or C# skills up in the future, I might migrate to those languages, which will make everything MUCH smaller.

There's more info in the readme, so if you care you should read it. There's a few known issues, biggest one is strange lockups when loading a directory. It then works good as never after that lockup. I don't know what's causing it, because the python code ran silkysmooth so I take it it's some PyQt or py2exe fuckup.

EDIT:
I just realised that if you specify a directory that does not contain "skybox" in it, the VTF location inside the VMT would be given as "<last character of the dir you specified>/<name you gave>+extension". SO YOU GOTTA HAVE A DIRECTORY WHICH HAS "skybox" in it. I should probably fix this.

I have the source at http://individual.utoronto.ca/vcool/vsky01a.rar It has the UI file as well, if you wanna look at that. It also has the readme, which should explain it a bit.

Oh, by the way, you should run vsky.exe to make this work.

---

There, my contribution to the internets is done. It's 3 am and I am hungry and I need to study for exams. And even though this whole "program" is child's play for a more experience coder, I'm quite proud of myself. :smt044 I also started to respect programmers more. You realise that making the program isn't actually the most significant task. Writing the readmes, making sure all the files are included and for a more complicated program - writing documentation, is all a headache.

Seriously guys, +1 respect for you. :smt023

If I didn't majorly fuck up I'll post this at SPUF and Polycount (although there aren't alot of people working with source there). You are free to spread the word as well.

I really hope this will make more people use custom skyboxes because new stuff is always great.

kfoodtiem
Last edited by vcool on Sat Dec 12, 2009 7:27 pm, edited 1 time in total.
Image

Neighborhood Forum Elitist
User avatar
vcool
Veteran
Veteran
 
Joined: Fri Jun 23, 2006 1:03 am
Location: USSR

Re: vSky 0.1a release

Postby srredfire on Sat Dec 12, 2009 8:25 am

Great job. Adding it to my box of tools.
srredfire
Veteran
Veteran
 
Joined: Sat Jul 22, 2006 10:44 pm

Re: vSky 0.1a release

Postby Surfa on Sat Dec 12, 2009 10:34 pm

20mb man. Would you mind if I tried rewriting it in c# or something to bring the file size down?
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: vSky 0.1a release

Postby evochinima on Sat Dec 12, 2009 10:51 pm

20mb isnt that much? Great tool, btw. Im not much into creating skyboxes, but still.
Image
User avatar
evochinima
Regular
Regular
 
Joined: Fri Nov 06, 2009 7:43 am
Location: Sweden (There's a polarbear outside my window!)

Re: vSky 0.1a release

Postby Surfa on Sat Dec 12, 2009 11:11 pm

Yeah but in c# with .net I think it would come in around 20kb and also long as you have the .net redistribute installed all you would need is the .exe plus it would allow me to dust of some of the cobwebs on c#.
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: vSky 0.1a release

Postby Kremator on Sat Dec 12, 2009 11:22 pm

Awesome tool :D
User avatar
Kremator
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Mon Jan 03, 2005 8:50 am
Location: the alarums of war

Re: vSky 0.1a release

Postby vcool on Sat Dec 12, 2009 11:41 pm

Surfa wrote:20mb man. Would you mind if I tried rewriting it in c# or something to bring the file size down?


Go on, it's very simple. I would try to do it myself but you'll do a better job knowing the language. :lol:
Image

Neighborhood Forum Elitist
User avatar
vcool
Veteran
Veteran
 
Joined: Fri Jun 23, 2006 1:03 am
Location: USSR

Re: vSky 0.1a release

Postby Surfa on Sat Dec 12, 2009 11:51 pm

I converted it to c# and added a icon for all you anal people out there like me who didn't want all the python requirements on your hard drive. It is 90kb uncompressed and can be downloaded from.
http://icy-bee.co.uk/vsky.rar
Hope you don't mind vcool

Also some stuff doesn't work like the progress bar (forgot to link that up and the help section but whatever.

If you use my version you set the skyname to be the name of you texture and the location is where it outputs it. It will then have the texture path as skybox/name of texture. So you will then place it in the skybox folder in materials and it should work perfectly.
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: vSky 0.1a release

Postby evochinima on Sat Dec 12, 2009 11:57 pm

Oh that was fast surfa!
Image
User avatar
evochinima
Regular
Regular
 
Joined: Fri Nov 06, 2009 7:43 am
Location: Sweden (There's a polarbear outside my window!)

Re: vSky 0.1a release

Postby Surfa on Sun Dec 13, 2009 12:08 am

Well I had the ui done before as I was messing around with the design view in visual studio.
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: vSky 0.1a release

Postby zombie@computer on Sun Dec 13, 2009 12:40 am

Heh, just don a quick 1:1 port from py to c#, came to 37kb :P
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: vSky 0.1a release

Postby Surfa on Sun Dec 13, 2009 12:46 am

zombie@computer wrote:Heh, just don a quick 1:1 port from py to c#, came to 37kb :P


Yeah that sounds about right although I added an icon so it made it come to around 90kb :(
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: vSky 0.1a release

Postby vcool on Sun Dec 13, 2009 12:57 am

Ran a quick test.

Image

vmt content:

Code: Select all
"Sky"
{
"$hdrcompressedTexture " "skybox/blaa_hdrrt
"$nofog " "1"
"$ignorez " "1"
"$basetexture " "skybox/blaa
"$basetexturetransform " "center 0 0 scale 1 2 rotate 0 translate 0 0"
}
"Sky"
{
"$hdrcompressedTexture " "skybox/blaa_hdrrt
"$nofog " "1"
"$ignorez " "1"
"$basetexture " "skybox/blaa
"$basetexturetransform " "center 0 0 scale 1 2 rotate 0 translate 0 0"
}


:(

Regardless, would you minnd posting the code? I'd love to see how it's done in C#. :)
Image

Neighborhood Forum Elitist
User avatar
vcool
Veteran
Veteran
 
Joined: Fri Jun 23, 2006 1:03 am
Location: USSR

Re: vSky 0.1a release

Postby Surfa on Sun Dec 13, 2009 1:00 am

I messed up slightly so it doesn't work quite right at the moment. But if you run it with the same name it will just add it to the bottom of the existing text.
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: vSky 0.1a release

Postby zombie@computer on Sun Dec 13, 2009 1:01 am

Code: Select all
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace vSky
{
    public partial class Form1 : Form
    {
        private string[] exts_hdr = new string[]{"_hdrft", "_hdrbk", "_hdrrt", "_hdrlf", "_hdrup", "_hdrdn"};
        private string[] exts = new string[]{"ft", "bk", "rt", "lf", "up", "dn"};
        public Form1()
        {
            InitializeComponent();
        }
        private void write_vmt(bool stretch)
        {
            string loc = tbLocation.Text;
            string loc2 = loc.Substring(loc.IndexOf("skybox"));
          string name = tbName.Text;
            foreach (string s in exts)
            {
                tbOutput.AppendText("Writing " + name + s + ".vmt\r\n");
                string f = "\"UnlitGeneric\"\r\n{\r\n";
                f += string.Format("\t\"$nofog\" \"1\"\r\n\t\"$ignorez\" \"1\"\r\n\t\"$basetexture\" \"{0}/{1}{2}\"\r\n", loc2, name, s);
                if (stretch && "ftbkrtlf".Contains(s.Substring(2)))
                    f += "\t\"$basetexturetransform\" \"center 0 0 scale 1 2 rotate 0 translate 0 0\"\r\n";
                File.WriteAllText(loc + "\\" + name + s + ".vmt", f + "}\r\n");
            }
        }

        private void write_hdr_vmt(bool stretch, int type)
        {
          string loc = tbLocation.Text;
            string loc2 = loc.Substring(loc.IndexOf("skybox"));
          string name = tbName.Text;
          foreach(string i in exts_hdr)
            {
                tbOutput.AppendText("Writing " + name + i + ".vmt\r\n");
                string f = "\"sky\"\r\n{\r\n";
                if (type == 0) f += string.Format("\t\"$hdrcompressedTexture\" \"{0}/{1}{2}\"\r\n",loc2,name,i);
                else if (type == 1) f += string.Format("\t\"$hdrbasetexture\" \"{0}/{1}{2}\"\r\n",loc2,name,i);
                f += string.Format("\t\"$nofog\" \"1\"\r\n\t\"$ignorez\" \"1\"\r\n\t\"$basetexture\" \"{0}/{1}\"\r\n",loc2,name,i);
                if (stretch && "ftbkrtlf".Contains(i.Substring(2)))
                 f += "\t\"$basetexturetransform\" \"center 0 0 scale 1 2 rotate 0 translate 0 0\"\r\n";
                File.WriteAllText(loc + "\\" + name + i + ".vmt", f + "}\r\n");
            }
        }

        private void cbHdr_CheckedChanged(object sender, EventArgs e)
        {
          rCompressed.Enabled = rHdrbase.Enabled = cbHdr.Checked;
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This is a small application that is supposed to quicken the process of skybox creation. Copy/pasting files multiple times over is quite an annoying task, so automation never hurts. Thanks to Mr. Chop and his excellent tutorial that gave me a kick in the butt to make this. Having made several skyboxes myself earlier, I thought about making an app like this but I never came around doing it.\r\n\r\n Too bad my effort won't make my grades any better as I was supposed to be studying for exams instead of doing this!","About", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void contactToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Version 0.1a\r\n\r\nMade by Vadim \"vcool\" Ptach in a span of three cold and lonely winter nights Dec 10 - 12, 2009\r\n\r\nWritten in Python 2.6 with Qt Designer and PyQt. \r\n\r\nE-mail me with suggestions or bugs at vptach@gmail.com. You can also find me at interlopers.net, official Steam forums (rarely go there), or boards.polycount.net.\r\n\r\nSource availible as a rar archive at http://individual.utoronto.ca/vcool/vsky01a.rar\n\nEnjoy :)","About",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }

        private void finddir_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fb = new FolderBrowserDialog();
            if (Directory.Exists(tbLocation.Text)) fb.SelectedPath = tbLocation.Text;
            fb.Description = "Please select a folder containing this skybox' files";
            if (fb.ShowDialog() == DialogResult.OK) tbLocation.Text = fb.SelectedPath;
        }

        private void tbLocation_TextChanged(object sender, EventArgs e)
        {
            tbLocation.ForeColor = Directory.Exists(tbLocation.Text) ? System.Drawing.Color.Black : System.Drawing.Color.Red;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                tbOutput.Clear();
                if (tbName.Text == "") throw new Exception("No skybox name specified");
                if (tbLocation.Text == "") throw new Exception("No skybox directory specified");
                if (!Directory.Exists(tbLocation.Text)) throw new Exception("skybox directory does not exist");
                if (tbLocation.Text.IndexOf("skybox") == -1) throw new Exception("Expected directory to contain a 'skybox' folder. Please specify another directory");
                if (!(new System.Text.RegularExpressions.Regex("^[ a-zA-Z_0-9-]+$").IsMatch(tbName.Text))) throw new Exception("Skybox name contains invalid characters");
                if (cbHdr.Checked)
                {
                    write_hdr_vmt(cbStretch.Checked, rHdrbase.Checked ? 1 : 0);
                }
                if (cbText.Checked)
                {
                    foreach (string s in exts_hdr)
                    {
                        tbOutput.AppendText("Writing " + tbName.Text + s + ".txt");
                        File.WriteAllText(tbLocation.Text + "\\" + tbName.Text + s + ".txt", "\"pfm\" \"1\"\r\n\"pfmscale\" \"1\"\r\n");
                    }
                }
                write_vmt(cbStretch.Checked);
                if (MessageBox.Show("Files are written! Do you want to open your location?", "This just in:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) System.Diagnostics.Process.Start(tbLocation.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
this was mine. Only a few minor additions (scanning for illegal chars in skybox name, reddening of skybox path if it doesnt exist). Probably couldve been shorter but meh
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands
Next

Return to Hardware & Software

Who is online

Users browsing this forum: No registered users

cron