Jump to content

KSPBlender - Blender Addon for importing .craft files (now with complete mod support!)


Dasoccerguy

Recommended Posts

KSPBlender - v0.95(ish) April 7 Update

Github Repo

PfDdRuk.jpg

(imgur link if the picture doesn't show up)

Here are the reddit posts I've made for anyone who's curious:

http://www.reddit.com/r/KerbalSpaceProgram/comments/2qfye6/wip_ksp_in_blender/

http://www.reddit.com/r/KerbalSpaceProgram/comments/2qmb25/wip_ksp_in_blender_update_1/

http://www.reddit.com/r/KerbalSpaceProgram/comments/2rcnxn/wip_ksp_in_blender_update_2/

http://www.reddit.com/r/KerbalSpaceProgram/comments/2s5d1p/wip_ksp_in_blender_update_3_beta_than_befo/

http://www.reddit.com/r/KerbalSpaceProgram/comments/2wye1v/wip_ksp_in_blender_update_4_still_alive/

http://www.reddit.com/r/KerbalSpaceProgram/comments/2xkcy7/addon_kspblender_update_5_much_better/

http://www.reddit.com/r/KerbalSpaceProgram/comments/31ssje/addon_kspblender_update_6_all_the_mods/

As well as the Trello page where I've been doing project organization:

https://trello.com/b/ffCPkGyM/kspblender

What it does

My project would be impossible without taniwha-qf's .mu importer addon for Blender (https://github.com/taniwha-qf/io_object_mu). It heavily relies on this.

  1. .craft file is loaded and parsed to find the locations and rotations of every part in the craft.
  2. The importer is called for every unique part (a crucial speedup over importing for every part).
  3. Parts are cleaned up by hiding collision meshes and things like that, then given a bounding sphere for manipulation.
  4. Parts are grouped into stages and can then be selected by stage.
  5. Materials are reworked to function in the Cycles renderer, Blender's physically-based render that (in my opinion) gives much better results.
  6. Animation data is time-shifted so that parts can be deployed and undeployed as desired.

Additionally I have added a custom menu pulled up by pressing K in object mode. I'm open to any suggestions for more features for this menu.

  1. "Select Ship" (based on the current selection, for moving everything around)
  2. "Select Stage" (if you wanted to break down the ship)
  3. "Select All of This Part" (like if you want to delete all the struts)
  4. "Toggle Deploy" (to go between the deployed and undeployed positions... getting reworked soon)
  5. "Make One Mesh" (useful for quickly applying one material to the whole ship)
  6. "Make 3D Printable" (almost works... makes the ship a unified, manifold mesh)
  7. "Toggle Editable" (to make the actual ship unselectable, only the spheres (more like how it is in game))
  8. "Delete Part" (use this to delete stuff... selecting a bounding sphere and pressing delete won't get it all)

I'm still working on several parts of the project to bring extra functions.

  1. Working on a kerbal, who you can see on the Trello page.
  2. I've also spent some time making an alternative model set that would give you a geodesic, "low-poly" look if you want that instead.
  3. I put some effort into making the model 3D-printable, but it's not as easy as it might seem.
  4. I will be reworking the animation toggle with Blender "Drivers," a cool feature I recently learned about.
  5. I'm going to add a streamlined process for creating panaround gifs and other simple renders.
  6. Like you, some of my coolest creations were assembled in orbit and not the VAB. I've found a way to import them from space... I just need some time to sit down and write the code.

Why you should care

I can't make you care if you don't want to ;.;, but I'm very excited about this project. It enables you to render any ship from any angle, with any lighting, with any setting. You could also render multiple ships together. Ultimately, you have nearly infinite freedom with Blender, from things like making gifs to show staging separation to making your ship look like it's made out of solid gold. Though you'll have to learn some Blender if you're going to do that stuff, which may or may not be an ulterior motive of mine :cool:.

Where the project lives

https://github.com/Dasoccerguy/io_kspblender

I'll be posting updates both here and on reddit, something like once a week until this is as done as it can be.

Please download the demo (and follow all the setup instructions) on the Github page and let me know what you think. Follow the installation instructions in the readme and you should be good to go!

Update 3-1

  1. Turned a messy collection of scripts into an easy-to-use Blender addon
  2. Continued work on the kerbal and low-poly modelset
  3. It should work on Linux and Mac now! Huge thanks to Sma for debugging.
  4. Added Kethane mod support, and working on B9 Aerospace.

Update 4-7

  1. Sorry I lied about the weekly updates
  2. This now supports EVERY MOD (thanks to Cptman's work)
  3. Tons of minor fixes to make things work a little better
  4. I need your help with the mods, though. There are going to be bugs, so please let me know what goes wrong!

This plugin is GPLv3 licensed.

Edited by Dasoccerguy
minor updates
Link to comment
Share on other sites

Wow. Just wow.

This has got to be the coolest thing for Blender that I've ever seen. :)

iuz5faq.jpg

Wee bit tricky to get it working, but hey, AMAZING! :D

Welcome, welcome to the forum, sir!

wD5fZYb.png

Magic! (Not the addon, Blender and Gimp.)

Edited by Starwhip
Link to comment
Share on other sites

Does anyone know how to use this? I'm blender-challenged, I have both the "io_object_mu-master" and the "kspblender-master" and have no idea what to do next.

I do!

Here:


kspblender
==========

KSP in Blender


This is all based around the python file ksparser.py, which operates on a given Kerbal Space Program .craft file
(the file type that ships are stored as)



HOW TO USE DEMO:


1. Download Blender from http://blender.org

2. Download .mu importer Blender addon from https://github.com/taniwha-qf/io_object_mu

3. Extract, put "io\_object\_mu\_master" folder (the whole folder) in Program Files\Blender Foundation\Blender\2.72\scripts\addons

4. Enable the addon in Blender. Press Ctrl+Alt+U or go to User Preferences under File. Go to the Addons tab, search for "mu" and enable the addon by clicking the little checkbox

5. Download kspblenderdemo.blend from this repository

6. Place .craft file into the same folder as the Blender file (they can be found under "saves" in the KSP.exe folder)

7. Follow these setup instructions: http://imgur.com/a/oTjPT

Change to Coding view

Change line 23, the KSP.exe directory, to your own directory (be sure to use double backward slashes!!!)

Change line 1196, the craft name, to be the name of that file

Change back to Default view

Press Run Script in the bottom right

Wait patiently

Press Render (or F12)


7. Ask for help on reddit if these instructions suck

8. Render, then press F3 in the render window and save the image where you want it.

9. You can do tons more, but it will require learning some Blender. I'm happy to help with that.



Project's Trello: https://trello.com/b/ffCPkGyM/kspblender

I English-ified the ReadMe a bit. :)

Also:

Javascript is disabled. View full album

Put the io_object_mu-master folder inside Blender's "scripts" folder. Mine was here: "C:\Program Files\Blender Foundation\Blender\2.71\scripts"

Then, inside "kspblender-master" is a folder called "demo". Open up the file called "kspblenderdemo.blend" with Blender.

Follow the instructions on the ReadMe: Copy your craft file into "kspblender-master\demo", where the .blend is.

Then, find the line WAY down at the bottom, where it asks for the name of your craft. Change it to the name of the craft INSIDE "kspblender-master\demo".

Near the top is a line where it asks for your KSP.exe directory. Go to KSP.exe, right click and go to Properties. Copy the "location" line into blender.

Then, hit "run script" at the bottom and it should work. I may have missed something. :)

Link to comment
Share on other sites

I can't find the coding view - I don't get that selection. Nevermind, found it :P I don't get blender at all, i guess i should sit down and learn it one day.

Your'e a lifesaver Starwhip.

EIDT ITS WORKING (or at least the program is frozen, not creating error - probably not smart to start with my shuttle :P )

Edited by zekes
Link to comment
Share on other sites

I can't find the coding view - I don't get that selection. Nevermind, found it :P I don't get blender at all, i guess i should sit down and learn it one day.

Your'e a lifesave Starwhip.

Hey, no problem. I just fiddle with the thing, and I can do some cool stuff.

But I hardly know a thing about it. Here's what the professionals do:

It makes me feel so small. :(

Link to comment
Share on other sites

Hey, no problem. I just fiddle with the thing, and I can do some cool stuff.

But I hardly know a thing about it. Here's what the professionals do:

It makes me feel so small. :(

:o Yeah. That is intense.

Ok the gnomes in my computer are hard at work loading my craft. :D

Link to comment
Share on other sites

Methinks I just killed Blender with the WAL I. :(

*crosses fingers* C'mon, you can do it!

Mine's still frozen. this might take a while :P

Tell me how long yours takes ,I'll multiply that by four, and that's how long my Shuttle will take.

Does this program auto-include the textures and everything? so it will look like your first screenshot?

Link to comment
Share on other sites

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA THIS IS SO AWESOME! uncaps.

I know! :D

Oh, BIG note!

Unless you want it to take five years to render, set the "Samples" setting to something low. The WAL I was at 10, I think, and Starstreaker III at 75.

By default it's at 1000. :D

Go to the little camera icon on the right hand panel, scroll down to "Sampling". It's in there.

WAxhIaS.png

Link to comment
Share on other sites

I know! :D

Oh, BIG note!

Unless you want it to take five years to render, set the "Samples" setting to something low. The WAL I was at 10, I think, and Starstreaker III at 75.

By default it's at 1000. :D

Go to the little camera icon on the right hand panel, scroll down to "Sampling". It's in there.

http://i.imgur.com/WAxhIaS.png

How do i move the camera, or get back to the model? I seem to be stuck in this view....

shuttlerender1.jpg

Link to comment
Share on other sites

Okay, prepare for a bit of complicated-ness. :)

Hit "CTRL+ALT+U". This opens the User Preferences panel.

TltNYBC.png

Check "Rotate around Selection". Save User Settings and close the panel.

If you're stuck in Camera mode, hit "0". That'll get you out of it.

Do "SHIFT+S". Click "Cursor to Center"

Then do "ALT+HOME".

Mousewheel zooms you out.

Then, click a part on your ship with left button. Stop, DON'T touch anything! :)

Holding down your mousewheel will let you rotate the view around the part you've selected. Find a good angle, and zoom out much farther than expected.

When ready, hit "CTRL-ALT-0" to set camera to your active view.

If not good enough, you can probably select the camera with the right mouse button if you click on the black outline, and then hit G to drag it around. Hitting "Z" twice lets you move it "in" and "out".

Left click when done, or hit ENTER.

Should be okay. (Downloading and trying it myself, just in case. :D)

EDIT:

Oh, boy, my fan is revving up. :)

If my computer slags I blame zekes' shuttle. XD

Edited by Starwhip
Link to comment
Share on other sites

Okay, prepare for a bit of complicated-ness. :)

Hit "CTRL+ALT+U". This opens the User Preferences panel.

http://i.imgur.com/TltNYBC.png

Check "Rotate around Selection". Save User Settings and close the panel.

If you're stuck in Camera mode, hit "0". That'll get you out of it.

Do "SHIFT+S". Click "Cursor to Center"

Then do "ALT+HOME".

Mousewheel zooms you out.

Then, click a part on your ship with left button. Stop, DON'T touch anything! :)

Holding down your mousewheel will let you rotate the view around the part you've selected. Find a good angle, and zoom out much farther than expected.

When ready, hit "CTRL-ALT-0" to set camera to your active view.

If not good enough, you can probably select the camera with the right mouse button if you click on the black outline, and then hit G to drag it around. Hitting "Z" twice lets you move it "in" and "out".

Left click when done, or hit ENTER.

Should be okay. (Downloading and trying it myself, just in case. :D)

aaah. Okay. Well I have to re- run the program now because i messed some stuff up - will have to wait another 15 minutes or so. Will have to go and delete all the launch clamps though.

Edited by zekes
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...