Fibermesh to maya curves (script)


#1

Well, it looks like there are a lot of fibermesh conversion plugs out there :slight_smile:

This is my contribution, a free script to convert fibermesh to maya curves:

fibermesh_to_curves.py

Currently the main drawback in maya, is that every curve is a single item, so after a certain number the scene becomes slower.
Anyway curves should be used as guides, not to be rendered as they are. In the next release (maybe tonight) I will add a control to generate only a certain percent amount of curves.

To use it:
- copy the script in your script folder
- in a shelf button, copy this code:


  import fibermesh_to_curves as ftc
   ftc.fibermesh_to_curves()
   

Please let me know if you’lll find some bugs and I will fix them

UPDATE:

You can also launch the script in gui mode, with this code:

import fibermesh_to_curves as ftc 
ftc.fibermesh_to_curves(guiMode=True)

And here there are two small videos showing the script in action:
Running the script
Converting curves to maya hair


#2

grande marioneeeee :smiley:

frk


#3

Thanks Frankino :slight_smile:

I just added the chance to specify a tolerance value.
This value must be in the range (0…1), where 1 means that all the fiber curves will be generated

So, if instead of writing:

import fibermesh_to_curves as ftc 
ftc.fibermesh_to_curves()

…you write:

import fibermesh_to_curves as ftc 
ftc.fibermesh_to_curves(0.5)

…then you will generate exactly half the curves.

Next days i will write a mel interface, such that it will be easier to interact with this value :slight_smile:


#4

Excellent work BluEgo. I’ll venture to try out our script when I get the chance.

And thank you for your generosity! :thumbsup:


#5

Thanks a lot for sharing!:buttrock:

Cheers!


#6

Really nice script, very handy. The density option in particular makes it really flexible.
Many thanks.

Cheers,
Brian


#7

Thanks Mario, this will go well with RMS.


#8

Thanks to everyone!

I just updated the above link with the mini-gui.
To activate it, copy this code in a shelf button:


import fibermesh_to_curves as ftc
ftc.fibermesh_to_curves(guiMode=True)

You can still use the script in the old way, specifying a value between the parenthesys instead of launching the gui.

I hadn’t the time to see if there are any bugs so far. It looks to work though. Please report any problem and I will try to solve them.

I am also considering to develop some tools for the generated curves, as I am not new to this kind of stuff.
The first I would like to do is to rebuild curves proportionally according their length, specifing a min/max number of vertices, and automatically generate and hair system.


#9

Hola.

I’m a newbie and on a Mac. Which script folder path should I place the python script into?

Thx


#10

I tested the script a little bit yesterday in both Maya 2009 and 2012 SAP and so far everything works like a charm. The only thing I noticed is that the curves are reversed/the starting cv is at the tip of the hair. Well, it’s nothing that a quick “Reverse Curve” can’t fix, but under certain circumstances something to be aware of.
Adding a gui is icing on the cake. I’ll check the new version out today.
Mille gracie, Mario!

 Cheers!

PS: Your additional ideas sound great!


#11

[I]Okay, just tried the latest version of the script in Maya 2012 and get this warning:

Warning: Not all selected edges were used in the curve. Selection must form a continuous, non-branching path. # [/I]

The script does not generate full curves along the entire length of the fibers. Instead the generated curves consist of just a single edge for each fiber.

Any ideas?

edit: Okay
this anomaly seems to happen through the use of GoZ.
When I export the Fibers subtool via the ‘Tool->Export’ procedure, and Import the resulting .OBJ manually into Maya, the script works as expected.


#12

Hey DutchDimension,
thank you a lot for your feedback!

I didn’t know about that, I always import objs.

I will fix it in a way you could import both trough obj and goz.

@trashtalk: Here there are all the paths you need (look for PYTHONPATH):
http://download.autodesk.com/us/maya/2011help/index.html


#13

[/QUOTE]
I am also considering to develop some tools for the generated curves, as I am not new to this kind of stuff.
The first I would like to do is to rebuild curves proportionally according their length, specifing a min/max number of vertices, and automatically generate and hair system.[/QUOTE]

That will be great for us new to using hair in Maya.
Thanks :slight_smile:


#14

So, I just updated the link above.
I wrote a general purpose routine to recognize the pattern of a poly strip.
It should work with goz now (and not only, even with hand made poly strips), but I still have to try with it.
Please report any issue and let me know if it works :wink:

Edit:
Mhhh, it looks like it still doesnt’ work with goz. I have to figure out what happens when files are transmitted with it.


#15

could someone do a quick video tut on how to setup this script and then adding a hair system for a simple render from Mentalray.
Just a ball with fiber hair on it would be helpful to see someones process.


#16

So, I just understood what the problem is with goz.
I assumed that the topology pattern stayed coherent for every polystrip, and actually it is, but it is granted only for vertices, not for edges which I used til now to generate the guides.
It is extremely fast to correct it, but my girlfriend has just come back into the city, so I will have to wait til tomorrow to fix it :slight_smile:

In the meanwhile, import the fibermesh as obj, as it looks to work correctly.

@GQ1: I will do a tutorial this weekend


#17

tu sei un principe, Grazie mille :thumbsup: :thumbsup:


#18

Does anyone know if the following works on Mac os X?

http://www.youtube.com/watch?v=NVNtY-WIgIk

Is this better than the above script?

Thx


#19

So, I finally updated the script.
Now it works with goz and is 50-70% faster :slight_smile:
As I said I will add more options to edit the generated curves, to better integrate them with existing hair solutions in maya.

@trashtalk: the link you posted refers to the first released solution about converting fibermesh to curves. I don’t know if it is compiled for Mac Os X though, but for sure it is a good solution and will cost you €20, not so much in the end.


#20

Hi Mario
i tried your script with the last zbrushR2b and goz for maya 2011: it works!
When i’m lucky and ZB doesnt crash, i export a fibermesh to maya usign goz, and then i run your script … u can see here a quick test with 10.000 fibers, converted in curves using your amazing script
here some screengrabs



thank you for this amazing work!!

I also tried this script… http://www.mariussilaghi.com/fibermeshsplinesmaya.htm
…but your script is really better man!

:slight_smile: