Rock generator script

one tough here

fi this is using DLL there must be a way to edit these file and remove the functions you don’t need
but then it becomes non standard !

on the other end if these functions are open soft then why not integrate these in python lib as a new DLL
or replace the ones there whith the numpy ones which are faster!
that would improve blender in any case!

happy 2.5

Ok, I have put up an updated version of the script. The big change is that I have started modifying material settings. Also, I have put together a version of the script that should not require NumPy, assuming I did not miss anything. It has the exact same features as the NumPy enabled version. You’ll find that link as an edit in my first post. The PDF has not been updated. Finally, I am trying to get this into the Blender upload, but the network has not been cooperating. I will post an update with the tracker for that if/when it finishes.

As for a light version of NumPy, it might be possible, I just am not willing to risk my main install, but I will get a virtual machine up and play with it in there. Unfortunately, all my virtual machines are on my external drive and I won’t have access to it until next Wednesday night :mad:. If you dig through the NumPy folder, it is almost entirely .py files so I would think it must be possible. It might require modifying some of the the config and initialization files though (which would be beyond my Python expertise). Along those lines, have you dig up any experts PKHG? :wink:

Oh, just want to give a quick thanks to both of you PKHG and RickyBlender for your feedback so far. Your keeping on my toes here :eyebrowlift:

Ok, tracker is up in upload: http://projects.blender.org/tracker/index.php?func=detail&aid=27314

No, not yet found a good expert …
I am trying to use setup in the random directory, but I got an annoying UTF* code error, which occurs rather often and I do not know why it happens.
I suppose (because the c compiler is called to …) that setup tries to compile things into a (dependent of your system) *.dll

As far as I can see now, core and random are needed (probably the rest of numpy not?!).

Just tried the numpy free script
A rock is created, but no parameter (in the toolbox) are visible and this error message:
Line 756 in generateRocks
Typeerror: float object is not subscriptable

(What I did, your script activated in a Text window run it and Shift A -> Rocks. W32 Vista)

Nice catch. I missed changing one of the NumPy calls. That has been corrected, and both .py links in the first post have been updated with a fresh version (I also added the tracker info in).

It looks like I am going to have a couple hours dead time tomorrow, so I will see if I can do some research into it.

usually UTF 8 code comes from the fact that you copied text from web or doc page!
and it’s a pain in the neck you need to find and remove all these UNF 8 codes or the script won’t work!

run and check on which line there is an error and retype it !
but does not always work

hope it helps

The script looks good so far from the images, I can see this being an addon that comes with Blender 2.58 final.

You might want to find a way to randomize the shape of the rock a bit more where the dimensions aren’t so regular (to allow for things like big pits, holes, hooks, snake-like shapes, T shapes, extrusions with hooks and pits ect…)

Also, this is to think about maybe months into the future, what if we can use an existing mesh to create a rock with a shape based on that mesh, could be useful for large rock formations that might be too complex to easily be done with a procedural algorithm using Python unless you’re extremely good with code. :wink:

Hmm … I will try, but there should be some better solution to say to Python take that code…???

well there is a beginning of a script to help but not easy to use

http://user.services.openoffice.org/en/forum/viewtopic.php?f=7&t=40681

and seems there is no command API to find these?

if you find a better way let me know cause i need this!

thanks

I have no problems running this script in my build with numpy.


thanks,
keep up the good work :slight_smile:

Gosh, I’m flattered by both of you. Adding my script into your build meta . . . making it into final. . . . :o Its rather encouraging. Thanks.

Yeah, that is a serious issue right now since there is a clear pattern if you generate more more than 10 or so. I am working from only 4 different base meshes which does not allow for much variety. Right now I have hard coded the mesh creation. Do you think it would be rational to try and code a process that will randomly create the meshes instead? Would it be smarter to just dream up and hard code more meshes? Or maybe should I just look for a way to make the current meshes more complex?

That is a really interesting idea. Guessing it would be built as a separate script since it would be starting with a base mesh. I will definitely have to play with that once this is addon is basically finished.

Now for a end-user type of question: would you guys find it useful if there was some form of mossyness texturing applied to the rocks? I ask since I have been unable to find a good way to make it work with the other base textures for the rock itself, and I don’t want to waste a lot of time on it now while there is a bunch of other stuff to finish if nobody is even going to be using it.

Oh, and I uploaded a bug fixed version. Main difference is I fix a couple bugs that occasionally resulted in some ugly results in the detail displacement modifiers and improved the base displacement modifiers. Also fixed a bug that was resulting in some odd spec/diffuse values. As usual I just updated the links in the first post. Oh, I did work some more on the material back end, but none of it will show right now.

Finally, how do I update the script on the tracker? I cannot figure out how :o

how do I update the script on the tracker?

  1. i think you need it to go in the contrib folder 1st.
  2. then u need to install an svn client checkout the script from the svn folder.
  3. make changes as you like on the file on your hardisk check if it is okay and running in blender.
    4.svn commit the file to server.

i included it in my build with numpy, i think it still heavy, setting the the preview to 1 removes the most details from the object, which makes it only useful for distributing, have you considered coding it in c, any way i like the details you have on the rock, thanks for the script.

For basic shapes, there are probably formulas out there to generate them without needing a base mesh, and after you do that it would be matter of applying a sort of noise to them like you are doing now.

Things may get a bit more complex once you get into real complex shapes to allow for the feature that I have suggested, I suggest you start with working on creating simple shapes like spheres and ovoids using an entirely procedural algorithm and then work your way up, because you’d probably would have a very hard time generating the real complex shapes if you don’t yet have an idea of how basic ones can be done without a base-mesh.

You also want to make sure the code is as simple as you can make it, yet it can do what you intend for it to do, while my only Python experience is with the game engine, I have had a lot of frustration before from making a problem too complex code-wise (or in other words I could’ve done it perfectly with less code what I couldn’t seem to do with more complex code)

Now for a end-user type of question: would you guys find it useful if there was some form of mossyness texturing applied to the rocks? I ask since I have been unable to find a good way to make it work with the other base textures for the rock itself, and I don’t want to waste a lot of time on it now while there is a bunch of other stuff to finish if nobody is even going to be using it.

This can be done by generating a vertex color layer for the rocks and then the user can use material nodes to turn the color data into a stencil onto which to apply moss, the vertex color method could also allow for more uses than just moss like using it as a stencil for materials with different colors or consistencies.

hi, recent api changes broke this.
here’s the fixed script for svn r36710
add_mesh_rocks.py
this is the Numpy version.
thanks.

Sorry for leaving you guys hanging a little. Between traveling and starting my summer job I have not had a chance to do much last week. Even so I do have an update up which adds textures but does not touch the settings for the textures.

If so, that would do it.

Thanks Meta-Androcto. The latest version I posted reflects the change. Also, I tried to upload them to the tracker as attachments but got an error. Is that to be expected? Same when I try to add a comment. . . .

So I did mange to do some research and it turns out you were right. There is a family of formulas out there called superformula/superellipse/superquadrics/supershape. That will definitely take me some time to code and test, but looks like a great way to go long term. So with that, I think it would be wise to place that on the back-burner at the moment and get the textures moving. Then I’ll start working it as a separate script (so I don’t break the rock generator) sans randomness and see what happens from there.

Awesome idea Ace Dragon . . . I would never have thought of that :p.

BrikBot,
hi, I’ll look into the tracker issues for you soon,
there has been some problems lately with it.

Thanks meta. I appreciate it.

I just put up a new update. A quick summary of changes:

  • Material and related texture generation has been added
  • Materials can be enabled/disabled in the tools panel
  • Displacement texture generation has been further tweaked
  • Script documentation has had a partial update (more needed right now)
  • Installation and usage PDF has been updated, though is still not current with the script
  • Tools panel has been updated to reflect addition of materials

Links for both versions of the script (NumPy and no-NumPy), the PDF, and the .zip with everything have been updated in the first post. I have uploaded a demo rendering based off of the default values. A slightly more interactive version can be viewed here (MS PhotoSynth).

Also as usual, if you have any comments, bug reports, or have a feature you would like to see, please post it. I’ll add it to my todo list :yes:

Attachments


Another small update and again the first post has the latest links. This one adds more base meshes that can be generated. Also, I have not been entirely idle as I have been doing research into fully random mesh generation (no success so far) and a couple other, smaller matters.

Question: does anyone know when the upload tracker is going to be fixed? I would really like to get the latest version in it but I am still getting the “Error: Missing Parameters” when I try add a new attachment or add a comment.

hi,
in the tracker page, go to comments, add a comment (don’t submit),
then go to attatchments page & add your attatchment then press Save Changes.
this will add your comment & the attatchment will upload.
Any problems, just ask. :slight_smile: