Server Help

Misc User Apps - blender 3d rotation kit

Smong - Mon Jun 20, 2005 9:15 pm
Post subject: blender 3d rotation kit
I thought I'd post some stuff I made to help turn 3d models from blender into ship sets. The quality and useability isn't that great but it might be useful to someone.

ssrot-blender.txt
This is a python script that will rotate multiple objects in 9 degree increments and save the renders to disk. If you open it in the blender text editor you can press alt+p to execute it. You'll probably have to edit it slightly to suit your model.

ssm/sprite sheet maker
A modded version of 'font sheet maker' than accepts the rendered frames (from blender or any other source) and assembles them into a shipset. Currently the input/output format is png, but I might change the input to support other formats.
You have to select all the frames at once using shift/ctrl click since I haven't written a fancy dialog to make it more obvious what's happening.

Here's a sample of the final output:
http://toktok.sscentral.com/dump/ship3.png (240k)
I'm still learning this 3d stuff so that's why it doesn't look too good.

Edit: Updated script (scroll down or http://forums.minegoboom.com/download.php?id=1234)

Edit: Video tutorial http://www.youtube.com/watch?v=f6ByhEIwLuo
blaine0002 - Mon Jun 20, 2005 9:30 pm
Post subject:
I dont use blender but i have to say,

Sweet ass tank icon_lol.gif
D1st0rt - Thu Jun 23, 2005 6:25 pm
Post subject:
Now anyone can make good 3d ships, as blender is free biggrin.gif
Smong - Fri Aug 05, 2005 10:42 pm
Post subject:
I have decided this is bugged. Take a look at this image:

The barrel doesn't line up with the red line where ss actually fires weapons. Can anyone figure this out?
(As you can see I also spent some time improving the tank since the original post).
Mine GO BOOM - Fri Aug 05, 2005 10:53 pm
Post subject:
Smong wrote:
The barrel doesn't line up with the red line where ss actually fires weapons. Can anyone figure this out?

Its an isometric view. Subspace works from a top-down view.
Smong - Fri Aug 05, 2005 11:01 pm
Post subject:
It should still be possible to automate the rotation and rendering process from a script regardless of camera angle. There is no way I am doing all 40 frames by hand. What if I re-skinned it or added more detail? That's another 40 painful manual rotations.

BF's CS and DOD shipsets along with wormhole surfers shipsets are all isometric. However extracting information from the zone owners/shipset creators is proving hard.
Mine GO BOOM - Sat Aug 06, 2005 12:36 am
Post subject:
Use trigonometry. Based upon the angle from top-down view, the line of sight of the barrel changes. Since you want it to be at set 9 degrees each step, you can determine the physical angle you need to move the tank at for your angle of view so it looks like it is stepping 9 degrees. It should come out as a sin wave type stepping system (like rotate 8.5 degrees, then 8.2, 8.0, 8.2, 8.5, 9.0, etc).

Either way, with a tank like that, I'd think it would look cooler if you'd have the turret be the turret.bm2 image, and the tank be ship8.bm2 or something. Then the ship would have its own weak machine gun, but only allow one ship to attach. Make it so whoever can attach starts with a blank or crappy ship, and when they attach, a bot will prize them bombs. Now, that would be pretty cool and very realistic. Bonus if you use ASSS so whenever someone issues an attach request, you actually change their ship to a Shark also, prize them with what they need. Then when they disattach, change them back to a normal ship, or remove their bombs. That way you are only sacrificing one ship to be a special for both a tank and the turret.
Smong - Sat Aug 06, 2005 10:09 am
Post subject:
I'll look into the trig thing, I suspected it might be one of the ways to do it.

I probably won't seperate the turret for this particular tank, but I'll see how it goes.
Dr Brain - Sat Aug 06, 2005 10:56 am
Post subject:
Ok. I did the math...

Basically, you want the angle defined by tracing out 1/40 the circumference of an ellipse.

The ellipse is defined as
x = cosine(sigma)
y = sine(phi) * sine(sigma)

Sigma is your incrementing of 9 degrees starting for due east moving northward if you drew a compass rose on the camera lens. Phi is the angle between the x-y plane and the ray along which the camera looks. I apologize for the unusual symbols. I started with the normal phi and theta, but theta dropped out pretty quickly.

Anyhow, the real angle to rotate can be found by the arctan of (y/x) compensated for the signs of x and y. You need to make sure you get the sign right, because the codomain of arctan is only pi/2 to -pi/2. and you want from pi to -pi (or 0 to 2pi, as the case may be).
Smong - Sat Aug 06, 2005 5:05 pm
Post subject:
With the help of Dr Brain I fixed the script to work with isometric views. I also took out an unecesary piece of code that slowed down the rendering process and added support for rolls! Sprite sheet maker can make the rolls image too, just change the number of rows to 40. Although I had to do 200 frames at a time and join the 2 halves together to make the final rolls image because my computer couldn't handle it.

Here's another ship I made, it took 2 and a half hours to make.

Anyone can use this ship and the rolls in their zone.
Quan Chi2 - Wed Aug 24, 2005 8:46 pm
Post subject:
lol the tanks from the first post looks like grey boxes with scratches on it lol
Anonymous - Wed Mar 29, 2006 12:24 am
Post subject:
How do I set the camera up properly to follow it
Smong - Wed Mar 29, 2006 8:32 am
Post subject:
Just make the model appear to be facing upwards like this:

The camera object is the solid rectangle, and the dotted rectangles give you some idea what will appear in the final image.

For this overlord tank I also added some tilt to make it appear 3D rather than a top down view.


If you put a tilt on it make sure to edit the script too:


If you're new to blender you can select objects (such as the camera) with right click. Then press "n" on the keyboard, a little window will pop up (called "Transform Properties") letting you adjust the position and angle of the currently selected object.

Edit: lol camera.png was actually a bmp, fixed it now.
BDwinsAlt - Thu Mar 30, 2006 5:27 pm
Post subject:
Dude that is awesome. Thanks for the post.
Anonymous - Fri Mar 31, 2006 7:42 pm
Post subject:
Never mind , all I had to do was center the model icon_smile.gif
Denon - Sun Jun 04, 2006 7:58 pm
Post subject:
That shipset is just awesome, beats the default ones hands down.
Nice work Smong.
Anonymous - Wed Jul 05, 2006 11:29 am
Post subject: problem
when i try to run the script, it gives me python script error and it highlights the following line:

obj = Blender.Object.Get(OBJECTNAME)

I don't know how to fix this
Smong - Thu Jul 06, 2006 8:50 am
Post subject:
In object mode select the object so the edge of it is pink. Then go to the mesh buttons (F9) to find out the name of the object. Finally edit the script to use the correct object name.

Infact I just noticed it also has the name of the object in white at the bottom left of the 3D window.
Anonymous - Sun Jul 09, 2006 9:23 pm
Post subject:
thx alot
Smong - Wed Feb 21, 2007 2:54 pm
Post subject:
I have made a short video explaining how to use the script:
http://www.youtube.com/watch?v=f6ByhEIwLuo

I also corrected one of my replies that had a bmp in it instead of a png icon_eek.gif
Mine GO BOOM - Wed Feb 21, 2007 3:01 pm
Post subject:
Smong wrote:
I have made a short video explaining how to use the script

Short seems to be the best word I have for it. Your text over the window is hard to read and generally isn't on the screen long enough to read it. If you have the original video still, I'd recommend added some black space to the bottom and putting subtitles there. Pause the video on the text a little longer.
Smong - Wed Feb 21, 2007 3:13 pm
Post subject:
Well I used windows movie maker.
- I tried the "subtitle" text overlay, but the text looks bad with anything other than white since it adds black fuzz around it, and you can't change the color of the fuzz. The only other type of text overlay that seemed to look good was "basic".
- Pausing the video is hard and fiddly, it involves splitting the video up, taking screenshots and inserting those like slide show frames.

Yes it could be better, but since it's a video I figure people can watch the parts that are too fast several times over, pausing it if necessary. I suppose I should redo it like you said, infact if I add a black bar at the bottom with virtualdub somehow that would change the aspect ratio, and if I'm correct that means youtube will store the video at a higher quality/res. I would like to be able to do that "zoom in" thing at specific places so people can see where I'm actually typing/clicking.
Mine GO BOOM - Wed Feb 21, 2007 4:04 pm
Post subject:
Taking 6 or so screen shots and just writing text under them in a webpage (such as the wiki?) would be just as useful as the video.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group