maya hair to standalone V2

Autodesk Maya (Plugin developed by JimStar)

Moderator: JimStar

prodviz
Licensed Customer
Posts: 543
Joined: Sun Jul 14, 2013 6:00 pm

Hi all,

are there any tutorials on how to export maya hair to Octane standalone V2?

I've tried nhair, and adding output curves to hair and saving out as alembic.

No luck so far.

Cheers,

Steve
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

Hi,

Here is a little python script to export paint effects hair (or any paint effects stroke for that matter) to and alembic file for import into the standalone, it will work for Maya hair and nHair also.

Installation:
Unzip the attached file and place PFXtoAlembic.py into your Maya scripts directory eg. C:\Users\User1\Documents\maya\2014-x64\scripts

Usage:
To run the script open the script editor and copy and paste the following two lines into an empty python tab.

import PFXtoAlembic
PFXtoAlembic.PFXconvert()

Select these and middle mouse drag the lines to a shelf to create a shelf button to run the script, clicking it will open an options dialogue.

The options in the dialogue are as follows:


Frame Range: - Pretty obvious, the first and last frame of the animation. They will default to the current time slider range. (I haven't built in a pre-roll yet so if there are dynamics involved you should always export from before or at the dynamics start frame.)

Curve Width: - The thickness you want the curves to render. The default is 0.01 and seems like a good starting point. I haven't managed to get tapered width working yet.

Output File: - The filename and location for the .abc file that will be written out. There is a browse button beside it to open the file dialogue.

Once you have your options set select the top node that contains the hair or Paint Effects strokes below it, if you are exporting many separate PFX strokes then make sure you have grouped them all under one group node first. Then click the Export button.

Notes and Limitations:

You should export your hair separately using this script and then your geometry using whatever alembic export you like and then bring them together in the standalone using a geometry group as for now it seems this is the only way to get a separate material pin for the hair object.

The script will rename your scene and save it with the suffix "_curveExport". This protects your original scene from any crashes or changes. The new scene will have the display percent attribute on the original strokes set to 0 and will contain the curves that were exported.

During the export the scene saves twice so if it is a large scene that takes a while to save it will take longer to execute.

Depending on the number of curves being generated it may take a while for the 'convert to curves' to happen before the alembic is exported, just be patient.

I haven't put any error checking into this script so if you try to click Export without anything selected it will give an error and not run.

You can only export one hair system at a time or more correctly one group of strokes at a time and these will come into the standalone as one mesh with all hairs in that mesh sharing the same width factor. If you have more than one node selected when clicking Export it will have unpredictable results as again I have not done any error checking for this at this stage.

If you need to export more than one hair system go back to the original scene, select the top node of the next hair system or group of strokes and re-run the script, remembering to give the .abc file a new name.

I may not advance this script beyond this point as it was mainly so I could test some full hair systems in v2.0 and to force myself to get coding again and start to learn python. I figure once the Maya plugin for v2.0 is done I won't need this.

Although the script may work in older versions you should be running Maya 2014 service pack 1 or later as the script exports Ogawa format alembics because Octane prefers these and earlier versions of Maya can't export these.

T.

https://vimeo.com/93686326
Attachments
PFXtoAlembic.zip
(1.43 KiB) Downloaded 312 times
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
prodviz
Licensed Customer
Posts: 543
Joined: Sun Jul 14, 2013 6:00 pm

Awesome TBFK, cheers. I'll try that.
The hair movement is cool.

Yeah, like you said, might not be such of an issue once V2 for maya is out.
Hope good old Jim Star is on the case ;)

cheers.
prodviz
Licensed Customer
Posts: 543
Joined: Sun Jul 14, 2013 6:00 pm

Unfortunately had the following error:

PFXtoAlembic.PFXconvert();
// Error: PFXtoAlembic.PFXconvert(); //
// Error: Line 2.25: Syntax error //
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

prodviz wrote:The hair movement is cool.
Thanks, The hair system dynamics I'm fairly happy with but this particular hair do is pretty bad, I only threw it together to test v2.0 hair and spent no time trying to make it in any way good. ;)

T.
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

prodviz wrote:Unfortunately had the following error:

PFXtoAlembic.PFXconvert();
// Error: PFXtoAlembic.PFXconvert(); //
// Error: Line 2.25: Syntax error //
What version of Maya are you running?

T.
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
prodviz
Licensed Customer
Posts: 543
Joined: Sun Jul 14, 2013 6:00 pm

Maya 2015 SP 2
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

prodviz wrote:Maya 2015 SP 2
I have just checked it here and it's working fine in Maya 2015 SP 1. If I get the chance I'll install SP 2 tomorrow and check it but I imagine it should be fine.

Have you run through the usage instructions again? Do you have any questions regarding them? It has been used successfully by at least one other user.

T.
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
prodviz
Licensed Customer
Posts: 543
Joined: Sun Jul 14, 2013 6:00 pm

Hey TBFX,

I don't know whether user error is a good thing or a bad thing sometimes, but it was my silly fault; I had the script editor set on mel instead of python.

All working beautifully now, thanks.

And thanks very much for putting the script together. Please don't stop developing this stuff. It's awesome.

Cheers,

Steve

very basic, rough test:
https://dl.dropboxusercontent.com/u/946 ... _movie.mov
Andrew88
Licensed Customer
Posts: 43
Joined: Mon May 31, 2010 9:43 am

hey man, thanks for this cool script :)

i just did a test today and it works great, however i had some export issues.

1.
when i did a small test, with only a few hairclumps the script exports relatively fast. But when i increased it to about 100 hairclumps, it took like forever to export. it took roughly 30 mins until it started to run through the timeline and begin the export.
2.
it seems like i am unable to export to other harddrives, i have only been able to export to my desktop. maybe it is something about sub directories?
3.
this is just an suggestion, it might be a good idea to put a checkbox in the script to enable/disable saving the scene. i ended up with many re-saved maya scenes.

but otherwise a very cool script ;)
kind regards
Andrew88
Post Reply

Return to “Autodesk Maya”