*** Script is now in Blender contrib. Latest version can now be found at https://developer.blender.org/diffusion/BAC/browse/master/add_mesh_rocks/ ***
Edit: Link to just the script: Script is now a module: http://www.mediafire.com/file/9bmldsccd4b7u31/add_rock_mesh.zip
Link to the x64 NumPy build used: http://www.mediafire.com/file/y6x7xdd3d37ool9/numpy-x64.zip
Link to an x86 NumPy build that should work: http://www.mediafire.com/file/6c6y56fj16q98sd/numpy-x86.zip
Edit 2: PDF manual: http://www.mediafire.com/file/28x2o0diwv2xov7/rock_doc.pdf
Edit 3: I have a version of the script that does not use NumPy available; No longer needed.
Edit 4: I have been building an archive of all past versions, so if you really want to use one of those, they are available: http://www.mediafire.com/?ca1nt2zag1ipz
Edit 5: Due to internal restructuring and morphing the script into a full Python module, I have removed some links that are no longer relevant.
Hey all,
Over the past couple weeks or so I have been getting my feet wet in Python and the Blender API. This was mainly spurred because of a project I started that is going to require me modeling a couple hundred rocks, and I figured this was a great opportunity to pick up some Python and the Blender API, though it is admittedly the Rube Goldberg approach. So as a result I started a rock generation script that (when finished) will generated rocks based on some user input, use modifiers for deformation, and then generate a material and procedural textures for each. At this point in time, the first two parts are mostly finished with the last not even started.
The script relies heavily on random value generation, right now it is primarily Gaussian based with an artificial skew allowed afterward. I would like to eventually replace this with a beta distribution for better results and better performance, but right now I have not yet figured out how to implement the bounds that are on the mean and variance to get valid alpha and beta values.
What the script does is it will generate a number of rocks, per user specification. Then using a user specified lower and upper bound for x, y, and z dimensions individually, in addition to the skew of the distribution (will be mean with the beta distribution) it will generate a hexahendron for the mesh. Once this is done, it will add 2 subsurf modifiers and 2 displacement modifiers. The level of the subsurfâs is based on the user setting the âdetailâ of the rock. The displacement modifiers are given a new random texture (in progress) and the strength of the displacement is randomly assigned based on a given user mean.
Some other random notes:
Currently I am not allowing over 1024 rocks to be generated, but that number will increase.
Use small values for the roughness. Large values produce some . . . interesting . . . results.
I would like to multi-thread the script as it should multi-thread very well, but seeing as I donât know parallel programming and donât have the time to learn for quite some time, that is not happening unless some else would like to pick this up and help.
Link to download: http://www.mediafire.com/file/6cn236y88nmf0bt/add_rock_mesh.zip
Credit to where itâs due. The process/concept is not entirely my own. This is based on a BlenderGuru tutorial: http://www.blenderguru.com/how-to-make-a-realistic-asteroid/
Important:
Because of performance concerns, this script uses NumPy for the random generator. I have included a 64-bit build of NumPy with the script, but if you are using a 32-bit build of Blender you will need to grab this yourself. Installation is fairly easy, but if you need help, let me know. I can help. I realize this is probably an annoyance, but I went and profiled pythonâs built in beta and Gaussian number generators against those in NumPy before deciding that they were going to be used in the script, and I found the NumPy generators to generally be at least 10x faster for the beta and 2x for the Gaussian, with the NumPy beta being fastest, followed by the NumPy Gaussian, Python Gaussian, and far in last the Python beta.
Most of my work in profiling the distributions and calculations to date for creating the skewed distributions can be found at http://www.mediafire.com/file/tavs5c6c93eofe9/Skewed%20Distribution%20Research.zip. If you would run the python script and let me know the results and the specs of your machine, I would appreciate it. It might just be that I am getting unique results and if so I would rather adopt a method that better reflects most machines.
Ok, this keeps getting longer so I better post this before I add something else . . .