Giter Club home page Giter Club logo

spaceshipgenerator's Introduction

Spaceship Generator

A Blender script to procedurally generate 3D spaceships from a random seed.

Spaceship screenshots

Usage

  • Install Blender 2.80 or greater: http://blender.org/download/
  • Download newest add_mesh_SpaceshipGenerator.zip from the Releases section
  • Under Edit > Preferences... > Add-ons > Install... open the downloaded ZIP file
  • Under Edit > Preferences... > Add-ons enable the "Add Mesh: Spaceship Generator" script (search for "spaceship")
  • Add a spaceship in the 3D View under Add > Mesh > Spaceship
  • Expand the Spaceship tab that appears in the bottom left of the viewport to adjust procedural generation settings

How it works

Step-by-step animation

Watch on YouTube: https://www.youtube.com/watch?v=xJZyXqJ6nog

  • Start with a box.
  • Build the hull: Extrude the front/rear faces several times, adding random translation/scaling/rotation along the way.
  • Add asymmetry to the hull: Pick random faces and extrude them out in a similar manner, reducing in scale each time.
  • Add detail to the hull: Categorize each face by its orientation and generate details on it such as engines, antenna, weapon turrets, lights etc.
  • Sometimes apply horizontal symmetry.
  • Add a Bevel modifier to angularize the shape a bit.
  • Apply materials to the final result.
  • Take over the universe with your new infinite fleet of spaceships.

Extreme examples

The following screenshots were created using extreme values for the number of hull segments and asymmetry segments to show how the algorithm works.

Extreme spaceship screenshots

Tips and Tricks

  • By default the script will delete all objects starting with Spaceship before generating a new spaceship. To disable this feature, remove or comment out the call to reset_scene() around line 735 in the main function.
  • You can provide a seed to the generate_spaceship() function to always generate the same spaceship. For example, generate_spaceship('michael').
  • The generate_spaceship() function takes many more parameters that affect the generation process. Try playing with them!
  • You can replace the textures with your own ones. All textures are applied using global-space cube UVs. hull_normal.png is a normal map that adds extra surface "greebles". hull_lights_diffuse.png is an additive diffuse texture to set the color of the window lights. hull_lights_emit.png is an emissive texture to make the windows glow in darkness.

Credits

Written for fun as part of the /r/proceduralgeneration June 2016 monthly challenge.

Released under the MIT License.

Authored and maintained by Michael Davies.

GitHub @a1studmuffin Twitter @butterparty

Special thanks to @panzi for bugfixes, a proper GUI and build script. Also to @mjrthemes for bugfixing, and @LendoK for the 2.80 port.

spaceshipgenerator's People

Contributors

a1studmuffin avatar mjrthemes avatar panzi avatar timgates42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spaceshipgenerator's Issues

what is the content under

what is the content ( space ship that is made from the generator ) under ( License or Copyright or creative commons )

Install instructions out of date?

I can't seem to get this to work using blender v2.83.0. I am installing and it isn't showing any errors, but then I can't see Spaceship from the Add Mesh menu. Not sure if I should downgrade blender to get this to work?

In blender 2.83.2 gives error in console - and the textures are not properly set.

Hello.
The errors it gives in console are
"Fake_module: addon missing bl_info gives bad performance!: then it follows the scripts directory \addons\build.py"
"Fake_module: addon missing bl_info gives bad performance!: then it follows the scripts directory \addons\spaceship_generator.py"
And when you add ship to the scene it is messed up and textures are not set properly.
Best Regards.

Impossible to get it

Newest OsX Mini M2
Sorry, I'm bit noob wi th all these things on Github, but afetr installing it as mentionned, when launching it in Blender (Add > Mesh > Spaceship), I got this :
(If someone has an idea, if I missed something, i'd be glad to know issue thank you)

Capture d’écran 2023-06-12 à 13 32 32
Capture d’écran 2023-06-12 à 13 32 53

Error while enabling Addon (_init_.py line 18)

Thanks for the awesome script, but I have a problem while installing the addon.

Here is the screenshot of error dump.
screenshot_1

I'm not really experienced on Blender or python.

Using Blender v2.69

Thanks again.

I found a seed and set of parameters that causes a reproducible crash

Seed: walnut!
Min. Hull Segments: 3
Max. Hull Segments: 6
Create Asymmetry: OFF
Min. Asymmetry Segments: 1
Max. Asymmetry Segments: 5
Create Face Detail: ON
Allow Horizontal Symmetry: ON
Allow Vertical Symmetry: OFF
Apply Bevel Modifier: ON
Assign Materials: ON

Now render it or display it in Material mode. Blender will hang.

TypeError: bpy_struct: item.attr = val: enum "Raw" not found in ('Linear', 'sRGB')

bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS', center='MEDIAN')
bpy.ops.mesh.generate_spaceship()
Python: Traceback (most recent call last):
  File "/home/kenorb/.config/blender/2.93/scripts/addons/add_mesh_SpaceshipGenerator/__init__.py", line 43, in execute
    spaceship_generator.generate_spaceship(
  File "/home/kenorb/.config/blender/2.93/scripts/addons/add_mesh_SpaceshipGenerator/spaceship_generator.py", line 724, in generate_spaceship
    materials = create_materials()
  File "/home/kenorb/.config/blender/2.93/scripts/addons/add_mesh_SpaceshipGenerator/spaceship_generator.py", line 458, in create_materials
    set_hull_mat_basics(mat, hull_base_color, hull_normal_map)
  File "/home/kenorb/.config/blender/2.93/scripts/addons/add_mesh_SpaceshipGenerator/spaceship_generator.py", line 436, in set_hull_mat_basics
    return add_hull_normal_map(mat, hull_normal_map)
  File "/home/kenorb/.config/blender/2.93/scripts/addons/add_mesh_SpaceshipGenerator/spaceship_generator.py", line 419, in add_hull_normal_map
    teximage_node.image.colorspace_settings.name = 'Raw'
TypeError: bpy_struct: item.attr = val: enum "Raw" not found in ('Linear', 'sRGB')

location: <unknown location>:-1
  • Blender v2.93.3 on Ubuntu.

Forked your repository

Hi,

I did not find any way to contact you via github, so I am contacting you via issues, I am extremely sorry for this. I saw your script for space ship generation and impressed by it, also I forked it and plan to improve it in multiple ways like sphere share space ship, pyramid, pentagon etc. Also planned to make it low polygon for games etc. Currently I have added create button, presets, y - z directions also and reset button. You can find link for it at blenderartists is [https://blenderartists.org/forum/showthread.php?401861-Space-Ship-Generator-Addon]

As I am pretty new to blender python and 3d programming, you are a professional. Is it ok with you if I update and when I feel it working fine with my changes, I can ask you for incorporate my changes. I am making it as open ofcourse.

Looking forward to hear from you.

Stupidy McStupidQuestion: How do I render ships?

Am I an idiot, or how do I get a generated ship to render like the pictures in the Readme? I run the default render settings, and the ships just look kind of flat, and the hull panels texture is almost invisible.

Run in Blender 2.8

Hi, thank you for the script !

Blender 2.8 changed some core functions.
It is certainly too soon to adapt the script now, as some changes are not completely settled, nor documented, yet (stable release in forseen in 2019 Q3 I think)

Anyway, I did some minor changes to run it in Blender 2.8, without materials.
https://github.com/vincent/SpaceshipGenerator

The code is absolutely not polished - hence no pr yet - but can be useful if you just want to try it in 2.8.

Cheers

License makes no sense

If in doubt, please get in touch. As a rule of thumb I'm fine with anyone
using these spaceships in commercial works, but I am less okay with people
selling the spaceship models directly for commercial gain. Use common sense.

Creative Commons Attribution By 3.0 does allow selling the model itself

Cycles support?

Hello
Thank you for developing this great tool!
Do you plan to add cycles suppoort?

Python error when tried to add spaceship

Python: Traceback (most recent call last):
File "C:\Users\Sujaya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\add_mesh_SpaceshipGenerator_init_.py", line 43, in execute
spaceship_generator.generate_spaceship(
File "C:\Users\Sujaya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\add_mesh_SpaceshipGenerator\spaceship_generator.py", line 669, in generate_spaceship
add_surface_antenna_to_face(bm, face)
File "C:\Users\Sujaya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\add_mesh_SpaceshipGenerator\spaceship_generator.py", line 341, in add_surface_antenna_to_face
result = bmesh.ops.create_cone(bm,
TypeError: create_cone: keyword "diameter1" is invalid for this operator

location: :-1

Spaceship generator not working in Blender 3.1

The error I am getting is this:

Python: Traceback (most recent call last):
  File "/home/wulfalpha/.config/blender/3.1/scripts/addons/add_mesh_SpaceshipGenerator/__init__.py", line 43, in execute
    spaceship_generator.generate_spaceship(
  File "/home/wulfalpha/.config/blender/3.1/scripts/addons/add_mesh_SpaceshipGenerator/spaceship_generator.py", line 669, in generate_spaceship
    add_surface_antenna_to_face(bm, face)
  File "/home/wulfalpha/.config/blender/3.1/scripts/addons/add_mesh_SpaceshipGenerator/spaceship_generator.py", line 341, in add_surface_antenna_to_face
    result = bmesh.ops.create_cone(bm,
TypeError: create_cone: keyword "segments" expected an int, not float

location: <unknown location>:-1

I have tried a couple of the fixes i have seen here and sadly none of them seems to work. It looks like a type casting issue to me but I can't see where the problem actually is because I'm not familiar enough with python or the code itself. Any help would be great

Can't Install

I try to add the folder to the add-on's section but it won't let me?
Any help?

3.6.0 error

File "C:\Users\jwill\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SpaceshipGenerator-master_init_.py", line 43, in execute
spaceship_generator.generate_spaceship(
File "C:\Users\jwill\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SpaceshipGenerator-master\spaceship_generator.py", line 669, in generate_spaceship
add_surface_antenna_to_face(bm, face)
File "C:\Users\jwill\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\SpaceshipGenerator-master\spaceship_generator.py", line 341, in add_surface_antenna_to_face
result = bmesh.ops.create_cone(bm,
TypeError: create_cone: keyword "segments" expected an int, not float

reports an error when i try to add spaceship

Screen Shot 2022-04-13 at 6 45 32 PM

Report: Error
Python: Traceback (most recent call last):
File "/Users/enda/Library/Application Support/Blender/3.1/scripts/addons/add mesh SpaceshipGenerator/init.py",line 43, in execute
spaceship generator.generate spaceship(
File "/Users/enda/Library/Application Support/Blender/3.1/scripts/addons/add mesh SpaceshipGenerator/spaceship generator.py", line 669, in generate spaceship
add surface antenna to face(bm, face)
File "/Users/enda/Library/Application Support/Blender/3.1/scripts/addons/add mesh SpaceshipGenerator/spaceship generator.py", line 341, in add surface antenna to face
result = bmesh.ops.create cone(bm,
TypeError: create cone: keyword "segments" expected an int, not float
location: :-1

Additional Fixes for Blender 3.1

I had also to change following lines/commands in spaceship_generator.py to work again in Blender 3.1:
bmesh.ops.create_icosphere - now needs parameter radius instead of diameter - line 310
bmesh.ops.create.cone - radius1, radius2 instead of diameter1, diameter2 - lines 200,232,245,,258,272,282,291,341,354,372,380
tip: use find&replace (worked for me)

Hope this helps
Thomas

Typos when calling 'generate_spaceship'

Hi @a1studmuffin, nice plugin, but i have found some typos in your code.
In init.py file the function call should be:

spaceship_generator.generate_spaceship(
  self.random_seed,
  self.num_hull_segments_min,
  self.num_hull_segments_max,
  self.create_asymmetry_segments,
  self.num_asymmetry_segments_min,
  self.num_asymmetry_segments_max,
  self.create_face_detail,
  self.allow_horizontal_symmetry,
  self.allow_vertical_symmetry,
  self.apply_bevel_modifier,
  self.assign_materials
)

Now arguments num_hull_segments_min and num_hull_segments_max are not passed, and assign_materials also.

GUI + batch-autogeneration of different spaceships?

Would it be possible to add a trivial GUI such as via pygobject, as well as
means to generate different spaceships via blender from the commandline,
to then display these as-is?

That way the user could select the model that may be most appropriate
such as for a game that makes use of spaceships, a bit like context
free grammar works (example for what I mean can be seen at the
cfdg gallery: https://www.contextfreeart.org/gallery/search.php?t=new&num=25)

Obviously this suggestion "works" only if the required work is not too
enormous, so perhaps the first step would be to have a way for the
SpaceshipGenerator to batch-generate different models via the
commandline, and then when that works plug in a minimal GUI
that shows these different results as-is via that app).

Differently sized spaceships, including smaller ones?

Hello Michael,

Not sure if this issue request is useful; if not, or if time is in short supply, please do feel free to close it down.

The spaceship generator idea is pretty cool; the spaceships are quite awesome too, some are just ... alien-weird. Would be cool to create meshes including inner structures e. g. such that one could use that for 3D games as-is. :D But this is not the feature suggestion here, just a random idea.

Feature request:

  • Would it be possible to also include examples (and screenshots) of smaller spaceships? The ones that seem to be generated by default seem to be fairly large ones. The idea may be to generate a wider range of spaceships, including smaller protective-ships accompanying the larger ones - a bit like in master of orion if anyone remembers that old game.

Anyway, if this is too much work, please ignore. The generated spaceships as-is are pretty cool.

Hope you have similar great ideas in the future. \o/

Thanks

Hi fellow Aussie, thanks for sharing this awesome script.

Add mesh spaceship not available

Add mesh spaceship not available in add menu (shift+A). After succesfully installing this addon in Blender 2.8, it's not available in add menu.

Generating large amounts of spaceships

I don't really know if this is an issue as such, but I hope it is ok here.

I would like to generate a large amount of ships, add a decimate modifier(to reduce polys) and save them all as .fbx files. I have looked at the code but I am a really bad at python and am unsure as how to bulk save like this. How would I go about this? Thanks.

Tighter integration with Blender

Right now if I modify the python scripts, I have to rebuild and reinstall the Blender plugin, right?

Is there a way to cut that whole process down (e.g. install the plugin once, and have the blender UI talk to the python script's parameters)?

[Documentation] How to add your own textures?

Hello Michael,

Not sure if this is worth reporting or not; please do feel free to close this issue at any moment in time.

Could a short subsection be added to explain how to add your own textures? I see that there are three .png files with the source code, so I assume that any .png file may work fine; but I have not tried so yet, so I'd like a pointer or two ideally in the documentation if that is possible. (I intend to test it lateron; blender's interface is pretty complex and I am no expert in python so it is not that trivial for me. Thanks!)

No more working in 3.1 - quick fix

Hello, spaceship generator - which I find AMUSING! - did not work anymore on my Blender 3.1: being a programmer I was able to reaad the log (it's an int - float conversion error) and managed to fix it in this way:

  • in spaceship_generator.py on line 340 simply substituted
    num_segments = uniform(3, 6)
    with
    num_segments = int( uniform(3, 6) )
    Now it works again! Hope this is useful to other people.
    Thanks again for this beautiful piece of software!
    Sincerely,
    Giorgio

how do start?

it's not working 4 me or u have made the how-to-start without it say the exact way of doing it.

IDEA: Textures don't stay with moving ship. Easy fix!

To create mapping that sticks to the ship but otherwise does the same thing as current mapping, I UV unwrapped the ship's mesh using "Cube projection," set the unwrap size to 1, connected the image node to UV texture coordinate input, and changed the image node mapping back from "box" to the default "flat." Not sure about code, though.

Compatibility with blender 2.8?

Hi, thanks for this script!

Currently I can't run this in 2.8. Last time this issue was raised in 2018 so I guess this is a right time to add this issue considering 2.8 stable is released.

Cheers!

Asking about the license

Hi a1studmuffin,

Sorry to contact you like this by creating an issue (do not know how to do so otherwise).

I have purchased many tools to help me in my Sci Fi assets to sell. I am very interested in this plugin to create the basis for my spaceships assets. Meaning, I do not want to sell the results of this plugins directly. Rather, I would like to build upon the generated spaceships using my different tools to create polished and customized ones to sell.

Is this OK?

Regards

Does not work on 2.83.1

Hello.
It does not load. There is no add/mesh/spaceships. It complains something about:
"fake_module: addon missing 'bl_info' gives bad performance" then the path to the scripts directory and spaceship_generatr.py

ImportError: No module named 'add_mesh_SpaceshipGenerator‘

Traceback (most recent call last):
File "C:\blender-2.76-windows32\blender-2.76-windows32\2.76\scripts\modules\addon_utils.py", line 324, in enable
mod = import(module_name)
File "F:\Documents and Settings\Admin\Application Data\Blender Foundation\Blenden2.76\scripts\addons\5paceshipGenerator-masten_init
.py", line 18, in
from add_mesh_SpaceshipGenerator import spaceship_generator
ImportError: No module named 'add_mesh_SpaceshipGenerator‘

[feature request] parameter GUI

I have no idea how plugins work in Blender but it would be awesome if the paremeters and seed could be tweaked from a GUI. Some of the extreme examples look really awesome and the repeatability of a seed would be nice to surface as an option without editing the script.

Update it for 3.4+?

It is useful
But it has too much error
AI GPT may could give us some help even makes it more powerful

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.