Random spaceship model generation script for Blender

Comments

  • Ha, I just came here to post this.
  • edited June 2016
    Interesting.
    Playing with it now.

    Looks good for Capitol ships. Might need tweaked for smaller ship.
  • This is awesome! Can't wait to try it, perfect for me who doesn't have time to make their own!
  • edited June 2016
    I'm guessing the path for the images is expecting Windows as I can't view the textures for the models on Linux. Trying to tweak the code to fix it.

    Never mind. Still trying to learn blender. Works when I render it.
  • Tried exporting some generated ships to OBJ for EmptyEpsilon. Might take some work to get the models into the game. I'm having some problems with textures, even in other 3d software.
  • edited June 2016
    I wound up getting one into the game, but it relies on materials for details and doesn't appear to have a UV map.

    image

    The extra steps I took were to apply the Decimator modifier in Blender, export to OBJ without materials, then load the OBJ into MisfitModel3D and export back out into OBJ again. (Not sure why the last part was necessary, maybe Blender is throwing some weird vertices in that MM3D removes. If I didn't re-export the model, EE would crash on loading the mesh.)
  • I had similar results; used MisfitModel3d as well. Had crashes before I used MM3D. One model did have some holes I had to cap.
    I didn't use Decimator (haven't heard of it until now).
  • https://i.imgur.com/qthX9nb.png
    These are the export settings I use from blender.
  • Looks like others have found it as there's a new version released with bug fixes and a plugin.
  • edited June 2016
    EE crashes because the script doesn't create a UV map. MM3D creates one automatically when it exports to OBJ, but Blender doesnt. If I run a smart UV unwrap on the model in Blender before exporting it to OBJ, the model loads in EE.

    I'm also using the new generator plugin, and the UI makes it easier to set the randomization seed and configure or toggle asymmetry and materials. If I use the UI with the epsilon seed, and disable the bevel modifier and asymmetric components, the resulting model size with smart UV map is around 150kb. With bevels and asymmetric components enabled, it's about 5Mb.

    The models don't look terrible in game, but they do need some UV mapping and a decent texture to make up for the missing materials.
  • I wonder if we filed a issue about the export if they'll do anything about it.
  • edited June 2016
    It's not really a bug. The script creates models that rely on materials. EE's engine doesn't support materials.

    You can work around this by baking the materials. It's a little labor intensive, but considering the nature of these generated models it's probably scriptable, too.

    1. Generate the model in Blender.
    2. In 3D View, switch to Edit Mode.
    3. Select everything (A key).
    4. Unwrap the mesh (U key, select Smart UV Project).
    5. Switch to the UV/Image Editor. You should see a square-ish image with a bunch of lines on it. That's the UV map.
    6. Create a new image (Alt-N).
    7. Check "Selected to Active" in the Bake panel. (The Bake panel is at the bottom of the Render toolkit. By default, it'll be at the bottom of the right sidebar.)
    8. Click Bake. The other defaults should work (Bake: "Full Render", "Clear images before baking" checked, distance 0.000, Bias 0.001, margin 16px, split Automatic). You should see Blender fill in the UV map image.
    9. Save the image (F3). That's your texture.
    10. Export the model to OBJ.

    Stick the texture and model in EE/Resources, add them to the model_data file, and congratulations:

    image

    You could break the Bake step into more granular parts to generate the illumination and specular textures.
  • edited June 2016
    Will give that a try.
    Wonder if that could be automated in the script, or put in another one.
  • edited June 2016
    As I thought, getting specular and illumination textures was as simple as creating a couple extra images in Blender and using specular intensity and emission bake modes, respectively. Here are some more glamour shots:

    image

    image

    image
  • edited June 2016
    A couple quirks that I noticed:

    - The models face backwards when used in EE. This can be fixed by either rotating the model before exporting, or changing the Forward from -Z Forward to Z Forward while exporting.

    - The models are small; the one in the shots above uses setScale(48) in the model_info to get about as large as a default Atlantis cruiser.

    - The script knows when it's generating engine panels and turrets, so there might even be a way to script the ModelInfo block complete with engine emitter and beam locations.
  • I've got the script roughly generating ModelData, including turret placement and engine emitters. I'll post up when I've got a moment to clean up the Lua output, which still needs some editing after generation.

    image
  • edited June 2016
    I can't figure out how to script the baking. Here's what I've got so far.

    Note that my Python is worse than my Lua, which is worse than my C++, which is worse than my JavaScript. ¯\_(ツ)_/¯
  • Did you end up with some generated ships that you like?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!