maya animation files into blender for fur

General discussion about the development of the open source Blender

Moderators: jesterKing, stiv

ricshal
Posts: 1
Joined: Tue Mar 16, 2010 7:36 pm

maya animation files into blender for fur

Postby ricshal » Tue Mar 16, 2010 7:43 pm

can maya's animated character, be put into bender for fur simulation and rendering. because blender's render is fast and better for fur simulation.

MadMesh
Posts: 90
Joined: Wed Mar 17, 2004 1:50 pm
Location: The Netherlands

Postby MadMesh » Tue Mar 16, 2010 9:30 pm

I dont know if Blender is better for fur or rendering. I would love to have Mental Ray in Blender the way it is in Maya.

Anyway, getting a fully rigged and animated model from Maya to Blender is damn near impossible. FBX comes to mind, but Blender can only export to that format.

P4blo Solís
Posts: 5
Joined: Fri Mar 12, 2010 5:55 am

Postby P4blo Solís » Wed Mar 17, 2010 1:54 am

You can do it... http://vimeo.com/2376664

But you cant import the rig, you have to make a vertex caché and import the vertex animation to blender, there you can add hair to the character and render.

Blender hair its quite good, maya fur is a headache and even using the haircut plugin will be painful...

surfingusa
Posts: 1
Joined: Sun Jul 11, 2010 6:04 am
Location: Wellsville, OH

Re: maya animation files into blender for fur

Postby surfingusa » Sun Jul 11, 2010 6:13 am

ricshal wrote:can maya's animated character, be put into bender for fur simulation and rendering. because blender's render is fast and better for fur simulation.


Is Blender compatible with the .obj files created in the older versions of Maya? I have Maya 6.0.1 that I use for creating 3D models that I import into my Battlefield 2 maps. I also use it for creating navmeshes. Is Blender suitable for this thpe of work?

Guillaume22
Posts: 3
Joined: Fri Sep 25, 2009 12:04 am
Location: France

I've done it !

Postby Guillaume22 » Tue Dec 14, 2010 10:58 am

Hi,

I'm actually working on a studio and for my job, I need to create Smoke and used Blender.

For productivity reason, I didn't take time to make an interface (maybe next time).

So I've created this small script that export *.obj sequences from Maya, and then import it to Blender :

You'll need to paste this script to Maya script editor and change the first 3 variables :
Note : do not write .obj after the file name

Code: Select all

int $startFrame = 1;
int $endFrame = 24;
//Linux user
string $file = "/home/you/folder/file"
//Windows user (uncomment the next row and comment the previous one)
//string $file = "C:\\your\\folder\\file"

for ($i=$startFrame; $i <= $endFrame; ++$i)
{
   currentTime $i;
   file -op "groups=1;ptgroups=1;materials=0;smoothing=1;normals=1" -typ "OBJexport" -pr -es ($file + $i);
}



Then in Blender 2.5 (do not work with 2.4 and before), paste the next script in the text editor, change the first 3 variables and Run Script
(same variable and do not write .obj after file name)

Note : Create a new file to import you obj sequence is safer.

Code: Select all

import bpy

startFrame = 1;
endFrame = 24;

#Linux
file = "/home/you/folder/file"
#Windows
#file        = "C:\\your\\folder\\file"



   
i           = startFrame
   
bpy.ops.import_scene.obj(filepath=(file + str(i) + ".obj"))

bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_name(name="Mesh")

bpy.ops.object.shape_key_add()

i1          = 1
while i <= endFrame:
    bpy.ops.import_scene.obj(filepath=(file + str(i) + ".obj"))
   
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.select_name(name="Mesh.001")
    bpy.ops.object.select_name(name="Mesh")
   
    bpy.ops.object.join_shapes()
   
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 0.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i-1))
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 1.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i))
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 0.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i+1))
   
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.select_name(name="Mesh.001")
    bpy.ops.object.delete()
   
    i += 1
    i1 += 1
   
bpy.data.objects["Mesh"].data.shape_keys.keys[i1 - 1].value = 1.0
bpy.data.objects["Mesh"].data.shape_keys.keys[i1 - 1].keyframe_insert("value", frame=(i))


+
Guillaume

Alessio
Posts: 5
Joined: Tue Jun 28, 2011 3:40 pm

Re: I've done it !

Postby Alessio » Tue Jun 28, 2011 4:20 pm

hello
I do not understand your explanation.
I am very interested in this topic.
I also work with Maya and Blender
could help me understand better?

Alessio
Posts: 5
Joined: Tue Jun 28, 2011 3:40 pm

Re: I've done it !

Postby Alessio » Tue Jun 28, 2011 4:23 pm

I use Maya 2011 and Blender 2.58.
are not very good with scripts so I have trouble understanding

am an Italian boy

Guillaume22
Posts: 3
Joined: Fri Sep 25, 2009 12:04 am
Location: France

Postby Guillaume22 » Tue Jul 26, 2011 12:42 pm

Hi,

sorry for the very late answer...

And sorry for my poor english.

I'll try to explain it a bit more these scripts :


1. In Maya

Open the script editor and paste the following script :

If you are a Linux User

Code: Select all

//Change the next 3 variable for your scene
int $startFrame = 1;
int $endFrame = 24;
string $file = "/home/you/folder/file"

for ($i=$startFrame; $i <= $endFrame; ++$i)
{
   currentTime $i;
   file -op "groups=1;ptgroups=1;materials=0;smoothing=1;normals=1" -typ "OBJexport" -pr -es ($file + $i);
}


If you are a Windows User

Code: Select all

//Change the next 3 variable for your scene
int $startFrame = 1;
int $endFrame = 24;
string $file = "C:\\your\\folder\\file"

for ($i=$startFrame; $i <= $endFrame; ++$i)
{
   currentTime $i;
   file -op "groups=1;ptgroups=1;materials=0;smoothing=1;normals=1" -typ "OBJexport" -pr -es ($file + $i);
}


Before you execute the script, change the 3 first variables :
- $startFrame = The beginning frame for the animation you want to export
- $endFrame = The last frame of this animation
- $file = Folder and file name where you want to export the .obj sequence. Do not enter .obj. Script will automatically increment and add extension (example : "/home/guillaume/export/file". Script will create file1.obj, file2.obj...). For windows, enter 2 \ to separate folders (example : C:\\Users\\guillaume\\export\\file).

Then, select the animated object you want to export. It must be a mesh.
Execute the script (CTRL+ENTER in maya script window).


2. In Blender 2.5

Create a new scene and delete all objects (camera, cube, light)

Open the text editor and paste the following script :

For Linux users :

Code: Select all

import bpy

startFrame = 1;
endFrame = 24;
file = "/home/you/folder/file"

   
i           = startFrame
   
bpy.ops.import_scene.obj(filepath=(file + str(i) + ".obj"))

bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_name(name="Mesh")

bpy.ops.object.shape_key_add()

i1          = 1
while i <= endFrame:
    bpy.ops.import_scene.obj(filepath=(file + str(i) + ".obj"))
   
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.select_name(name="Mesh.001")
    bpy.ops.object.select_name(name="Mesh")
   
    bpy.ops.object.join_shapes()
   
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 0.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i-1))
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 1.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i))
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 0.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i+1))
   
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.select_name(name="Mesh.001")
    bpy.ops.object.delete()
   
    i += 1
    i1 += 1
   
bpy.data.objects["Mesh"].data.shape_keys.keys[i1 - 1].value = 1.0
bpy.data.objects["Mesh"].data.shape_keys.keys[i1 - 1].keyframe_insert("value", frame=(i))


For windows users :

Code: Select all

import bpy

startFrame = 1;
endFrame = 24;
file        = "C:\\your\\folder\\file"

   
i           = startFrame
   
bpy.ops.import_scene.obj(filepath=(file + str(i) + ".obj"))

bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_name(name="Mesh")

bpy.ops.object.shape_key_add()

i1          = 1
while i <= endFrame:
    bpy.ops.import_scene.obj(filepath=(file + str(i) + ".obj"))
   
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.select_name(name="Mesh.001")
    bpy.ops.object.select_name(name="Mesh")
   
    bpy.ops.object.join_shapes()
   
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 0.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i-1))
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 1.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i))
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].value = 0.0
    bpy.data.objects["Mesh"].data.shape_keys.keys[i1].keyframe_insert("value", frame=(i+1))
   
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.select_name(name="Mesh.001")
    bpy.ops.object.delete()
   
    i += 1
    i1 += 1
   
bpy.data.objects["Mesh"].data.shape_keys.keys[i1 - 1].value = 1.0
bpy.data.objects["Mesh"].data.shape_keys.keys[i1 - 1].keyframe_insert("value", frame=(i))


As for the maya script, you need to change the first 3 variables with your scene value (startFrame, endFrame, file). These values are the same as you specify in the maya script.

Then execute the script.

During the process, Blender "freeze" but you have to wait. I suggest you to open blender with a terminal to follow the operation (in the terminal, blender says : "Importing file1.obj, importing file2.obj...).

Important : If you export/import to big mesh or to much frame at one time, you'll need a computer with lots of memory. Importing .obj sequence copy each file in memory before finishing the process. Your computer can become very slow during the process if you import a to big obj sequence.

I expect this message is more understandable.

+
Guillaume

enzyme69
Posts: 2
Joined: Thu Jun 02, 2011 12:40 am
Location: Australia

Postby enzyme69 » Mon Feb 20, 2012 11:46 pm

Thanks for sharing the script, Guillaume! Really clear step-by-step explanation. I stumbled into this thread somewhat and lucky to find this gem. I have been looking for Blender script that can import OBJ sequences for animation.

Recently, myself has been researching on Interoperability between Maya and Blender, I wrote some of my notes at my blog:
http://blendersushi.blogspot.com/2012/0 ... tween.html
http://blendersushi.blogspot.com.au/201 ... -demo.html

In my current conclusion, the best way is to export out animation in MDD format. Export all the OBJ required and import each vertex animation into Blender as Shapekeys via MDD.

Like I wrote on my blog, from Maya, you need to download script called MDD-OBJ-exporter:
http://www.creativecrash.com/maya/downl ... j-exporter

Similar to Guillaume's script, that script help you to export out:
1. OBJ sequence
2. MDD vertex animation
3. Particles

So the step-by-step is like this:

FROM MAYA OUT TO BLENDER
1. Export out OBJ per object you animate
2. Export out MDD per object you animate

IN BLENDER
1. Import OBJ per object
2. Import MDD per object.

Inside Blender, each animated mesh will become a Shapekey vertex animation.

If none of this explain it, I will create video tutorial.

enzyme69
Posts: 2
Joined: Thu Jun 02, 2011 12:40 am
Location: Australia

Postby enzyme69 » Tue Feb 21, 2012 2:29 am

@Guillaume
I think your MEL script has typo and you gotta fix few lines, how about

Code: Select all

//Change the next 4 variables for your scene
int $startFrame = 1;
int $endFrame = 24;
string $file = "C:\\mayatmp";
string $filename = "mayaout";

for ($i=$startFrame; $i <= $endFrame; ++$i)
{
   currentTime $i;
   file -op "groups=1;ptgroups=1;materials=0;smoothing=1;normals=1" -typ "OBJexport" -pr -es ($file + "/" + $filename + $i);
}

electronicpulse
Posts: 1
Joined: Wed Aug 19, 2009 2:21 pm

Postby electronicpulse » Thu Jan 03, 2013 9:42 pm

Hey i've been trying to use this python exporter for maya on a mac, and it seems to work, i actually did a bouncing ball with only transformations from the transform node and it worked perfectly in blender, but once i start adding bones it goes a bit to hell with the deformations, it seems like the vertex orders change, but i don't know if it's in the OBJ or mdd, or when blender imports it.

any ideas?.
im using blender 2.65.5 and maya 2011 on OSX 10.6.8


very much appreciated!
success comes in cans, not can'ts


Return to “News & Chat”

Who is online

Users browsing this forum: No registered users and 1 guest