Code / Development / My Own Stuff May 14, 2011 @ 22:52

Ardor3D: Squad Interpolation

Just ported a spherical cubic (quadrangle) interpolation method to be used with Ardor3D‘s quaternions. I shamelessly ripped it, so I might as well share it:

    public static Quaternion lerp(Quaternion q1, Quaternion q2, double t,
            Quaternion store) {
        Quaternion c = Quaternion.fetchTempInstance();
        Quaternion d = Quaternion.fetchTempInstance();

        q1.multiply(1 - t, c);
        q2.multiply(t, d);

        q1.add(q2, store);
        store.normalizeLocal();

        Quaternion.releaseTempInstance(c);
        Quaternion.releaseTempInstance(d);

        return store;
    }

    public static Quaternion slerpNoInvert(Quaternion q1, Quaternion q2,
            double t, Quaternion store) {

        Quaternion c = Quaternion.fetchTempInstance();
        Quaternion d = Quaternion.fetchTempInstance();

        double dot = q1.dot(q2);

        if (dot > -0.95f && dot < 0.95f) {
            double angle = MathUtils.acos(dot);
            q1.multiply(MathUtils.sin(angle * (1 - t)), c);
            q2.multiply(MathUtils.sin(angle * t), d);
            c.add(d, store);

            divide(store, MathUtils.sin(angle), store);
            store.normalizeLocal();
        } else {
            lerp(q1, q2, t, store);
        }

        Quaternion.releaseTempInstance(c);
        Quaternion.releaseTempInstance(d);

        return store;
    }

    public static Quaternion divide(Quaternion a, double n, Quaternion store) {
        if (0 == n)
            throw new ArithmeticException("Divide by zero!");
        return store.set(store.getX() / n, store.getY() / n, store.getZ() / n,
                store.getW() / n);

    }

    public static Quaternion squad(Quaternion q1, Quaternion q2, Quaternion a,
            Quaternion b, double t, Quaternion store) {
        Quaternion c = Quaternion.fetchTempInstance();
        Quaternion d = Quaternion.fetchTempInstance();

        slerpNoInvert(q1, q2, t, c);

        slerpNoInvert(a, b, t, d);

        slerpNoInvert(c, d, 2 * t * (1 - t), store);

        Quaternion.releaseTempInstance(c);
        Quaternion.releaseTempInstance(d);

        return store;
    }

Will Perone, thanks!

EDIT: The previous version had a divide-by-zero problem, which should be fixed in the code above.

On the Web May 6, 2011 @ 12:02

Rain Town by Hiroyasu Ishida

What can I say? It’s just beautiful.

If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

And here’s another one he made:
Somehow, a lot of short animations nowadays seem to be all about running, chasing, falling, being chased. Well this one is no different, or is it?

If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

My Own Stuff / Pictures April 3, 2011 @ 23:18

Scooter Trip Pics

Two trips actually. One was to the north of Amsterdam, towards Marken. The other lead us to the Amsterdamse Waterleidingduinen (Amsterdam Waterworks Dunes), a nature area where much of our drinking water comes from and where fallow deers roam freely, which is rare in ‘City Park The Netherlands’. Definitely a place you might want to visit when you’re near and like to hike.

My Own Stuff / Personal / Pictures April 3, 2011 @ 23:06

Some More Tisse

Baby alert! Skip these pictures if you don’t like babies…

Read the rest of this entry…

On the Web April 2, 2011 @ 10:46

Pendule Short Film by Ruud Terhaag

Quite a while ago since a friend of mine made this graduation film. Still a very inspiring style and interesting take on how to combine video footage with computer generated imagery. Check out his other work on Vimeo as well.

If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

By the way, I made the music you hear at the start of the film ūüôā

Development / Tips March 13, 2011 @ 16:07

Script: Connect Maya Nurbs Curves


This simple python script does not actually attach two curves.
Instead, it matches the first and last two control vertices to ensure continuity in translation and velocity.
Which ends will be connected is determined by selection order and curve direction.

EDIT: Ignorant me, I just discovered that Maya already has a built-in command for this: alignCurve.
Read the rest of this entry…

Tips March 4, 2011 @ 11:40

MP4 Files in Adobe Premiere

If you’ve used Premiere, you’ve probably had the problem of not being able to open MP4 files. “Unrecognized file format” or something similar.

The solution is simple: Rename the movie to change the extension to .mov and Premiere will import the file properly.

Development / Tips February 7, 2011 @ 00:46

Setting up SVN on Ubuntu

On my quest to get a proper version control system installed on a cheap low-spec machine that’s always running, this is what I came up with so far. I’ll try to write a quick tutorial, just highlighting the steps you need to get it up and running. Shouldn’t be too difficult.

Before, I set it up using Apache2 on my Ubuntu machine, accessible from port 80 with a regular web browser, easy. But after a while it started being really slow and unresponsive.  After some poking around, I discovered 10 to 20 apache processes, each taking up about 5 mb. My little media-playing Atom pc was choking.

The solution I found was to get rid of Apache altogether for this purpose and just run svnserve. Much easier to set up a and quick as a bunny!

First, install Ubuntu. Leaving that up to you. You should probably know how to open a console:¬†CTRL+ALT+F1 from the ‘desktop’ (ALT+F7 to go back to the desktop). Now we can tell the computer to do things.

Install Subversion (SVN):

sudo apt-get install subversion

Now create a repository to store our actual data. Replace “/path/to/svnRepository with the path you want to use:

svnadmin create /path/to/svnRepository

You might want to set up some protection by requiring a username and password. Type this in the console:

nano /path/to/svnRepository/conf/svnserve.conf

Nano is a simple text editor, use your arrow keys to navigate. Look for this line

# password-db = passwd:

and change it to this:

password-db = passwd:

Also, make sure you change this line

# anon-access = read

to this:

anon-access = none

Press CTRL+X to exit Nano. It will ask to save the file, press Y to confirm that.

Then we set up a password by editing the passwd file:

nano /path/to/svnRepository/conf/passwd

You’ll see some lines of text there, add one line at the end. I’ll assume your name is ‘John‘ and your password ‘ILikeLOL‘:

John = ILikeLOL

You can add more users if you like. Then again, exit with CTRL+X and press Y to confirm the write.

Protect the file:

sudo chmod 600 /path/to/svnRepository/conf/passwd

The only thing we need to do now, is start the actual svn server every time the computer boots up by creating a script as such:

sudo nano /etc/init.d/svnserve

Type in this command that will start the server as soon as the script is run:

svnserve -d -r /path/to/svnRepository

You know the drill, exit (CTRL+X) and save (Y). All done! Well, almost. Now we reboot the computer and you should have your own SVN server!

There is a fair chance that I missed something or this doesn’t work at all. If so, drop a comment below.

Development / Tips February 6, 2011 @ 22:27

Version Control

A version control system is a server-based system on which you can store multiple versions of files without having to rename them or sacrificing too much disk space. Initially designed to store text files (code), it can also store binary assets, like pictures or audio files just fine. So why not just backing stuff up with whatever came with your computer? Many people working with computer files have the problem of having filenames like this:

SomeDesign.psd
SomeDesign1.psd
SomeDesign2.psd
SomeDesign1_New.psd
SomeDesign1_New_Final .psd

To solve this you could add dates to the file (SomeDesign_2010_01_01.psd) names or just keep adding numbers.
Not too practical because you’d need to keep a description of every file somewhere. I used to name files like this and tried all sorts of naming methods. But you work fast, save an extra version that your client likes and eventually, it becomes a mess.

This is where a version control system comes in. You just keep the same name, add a short description and throw it on the server that stacks it neatly into it’s database, keeping all older versions. At any time you can get an older version by number, date or description without having to move around stuff. And it’s easy to back up as well.

For teams it has even more benefits. If you’re working together on the same set of files, a website or a game for example, you try to keep in sync by copying files over a network, figuring out which ones are updated. Version control lets you update a project, just altering the new files and warning you if somebody has been working on the same file as you did. You could even lock the file that you’re working on to make sure nobody else can write it meanwhile.

There are numerous version control systems available. To name a few from the top of my head: CVS, SVN, GIT, Perforce, etc. Some of them are commercially available and very good. Perforce for example is a fantastic system that handles all kinds of files really well and is extremely easy to set up, but it has a price tag. Git seems to be very good, but I haven’t looked at it (yet).

In short, if you’re creating a lot of file versions and your harddrives and your usb pen drives are becoming a relic of human chaotic organization… it’s probably worth looking into this.

If you want to use a version control system, you need some place to store your stuff. This can be done at a globally accessibleGoogle, Sourceforge, GitHub or whatever free or payed service you can find. Or better and more fun, you can set up your own at home or in your company’s network. I’m using Ubuntu on an low-spec Atom/ION-based mini computer, attached to my TV, that also plays my music and videos. I’ve written a quick guide to set up Subversion (SVN) on such a machine here.

Development / My Own Stuff January 23, 2011 @ 16:17

Find B-Spline Velocity/Tangent

As I’m not really good at maths, figuring this out took me a while; I wanted some code to let an object follow a long smooth path. But googling for hours didn’t give my any usable results.

One way to solve this, is to take two points on the curve and use the normalized difference to have a vector that is aligned to the curve. But this is imprecise and I wanted to do this properly.

Read the rest of this entry…