Skip to content

201. Luke Skywalker’s worst nightmare

February 27, 2015

No it’s not a misprint, this is another post on the theme of Star Wars. Actually, it is about building a 3D star destroyer, you know, something like this – entirely in Codea.

I could see straight away that this wasn’t as hard as a lot of the Star Wars vehicles, because the body is made up of 4 large triangles joined at an angle, and the superstructure -all the layers at the back of the ship – is pretty rectangular, which can be done pretty easily with triangles.

The first thing I did was find some detailed diagrams of a star destroyer, and take some measurements. I’m not going to model all the details, just the big stuff that you notice.

The first part I built was the main body, ie the 4 triangles I talked about above. I fiddled with the measurements and drew the result, then fiddled some more, until it looked right. I found a nice texture on the net, and tiled the body with it (if you need to draw the same texture repeatedly across a surface of any shape, learn this trick, it’s my favourite of all time).

Then I built the engines, because they look really cool. I used LoopSpace’s shapes library to draw cones which were wider at one and than the other, and found a nice texture for them. I had to think about how to show the engine heat, but in the end found a nice flame texture and added it to smaller cones, tucked inside the engine cones.

The “cabins” on the deck were quite tricky, because the deck is at an angle, and it took a lot of fiddling to get them right, several hours in fact.

The lights around the side of the hull and the “cabins” are simply another tiled texture.

The round radar domes on top were also built with the shapes library.

The stars are random white dots on an image, textured to a sphere surrounding the camera, so no matter which way you turn, you see stars (I explained this in the previous post).

All in all, it took about 10 hours work to build this. I’m not telling you that to impress you, because that isn’t very quick. But when you work in 3D, a lot of the time you are staring at a black screen where the spaceship should be, it’s tricky to get it right.

Here is the result. I tumbled it about so you can get a good look at it (the sound is the correct engine noise for this monster).

I also made a little movie with it, called “Luke Skywalker’s Nightmare”. There’s something really impressive about that huge ship going overhead.

Note – when the star destroyer turns back toward the camera, it is all managed by one function which turns at a fixed rate until the destroyer faces the camera – all you have to give it is the current position, the target position, the current direction, and the permitted turn speed, and it does the rest. That function uses quaternions and something called lerp. I hope to post about this rotation stuff soon, because functions like this are so valuable. But I confess I don’t understand the math, so I have to be really careful what I write, and how I try to explain it.

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: