Home Technical Talk

[maya] froX : an xNormal script exporter for maya

13
greentooth
Offline / Send Message
Froyok greentooth
I don't support this script any more.
For a similar and still updated script for Maya please take a look at this one : http://www.polycount.com/forum/showthread.php?t=151048


So what is it ? Well this script simply edit an xml file based on the settings you chose on the UI and send the information to xNormal to generate the maps that you want.

The big advantage is that you don't have to launch xNormal to do that, the script do it for you. So you can work directly from Maya ! The script support the export of your low poly, high poly and a blocker mesh. You can of course tell to the script to use an external file as you high-poly (from example is you use a very big mesh from zBrush).


New version !
froXnormal 0.7.1

Download : froXno version 0.7.1

frox_0-6.jpg

1# How to install ?
======================
Put the content of the folder "frox_XX" inside your maya folder.
Ex : "My Documents\maya\2011-x64\"


2# How to launch ?
======================
Call the command "source froXno.mel; froXno;" in the mel command line for the first time.
You can use the "Make Shelf Button" to make a shelf button in your current shelf.


3# How to use ?
======================
1 -Set your export path inside the UI and the path to your xNormal program.

2 -Setup correctly your low poly mesh and your high-poly mesh

3 -Hit the export button at leats one time for eahc mesh

4 -Use "Bake texture(s)" to launch xNormal
The Export and the Bake are 2 separated part, no need to re-export when you just change one setting in the UI. To avoid errors and project management all the maps are generated inside your export folder. It's a voluntary choice to avoid to set multiple paths.


You can read the full explanation of the settings here : http://www.froyok.fr/blog/2012-10-maya-froxnormal-0-6-an-xnormal-batcherexporter-for-maya




Changelog :
//version 0.7.1
-updated the Cage slider : now a field with a +/- buttons (more precise and scalable)
-updated the SBM export, now totally silent (without the OK dialog after the export)
-fixed the export of the cage when using the SBM format

//version 0.7
-added a button to open the export folder
-added possibility to bake non-square textures.
-added "check nGons" button to check manually n-gons on a selected mesh.
-added a check before calling xNormal to see if LP/HP mesh have been exported
-updated the export path button, removed a conflic with the "froTools" script.
-updated the checkbox "Convert HP smth" to be false by default
-fixed an error about the WindowPref command when you load the script
-fixed the missing settings for the Curvature map (UI, preset and xNormal xml)
-fixed an error with the export path of the low poly mesh in the SBM format.
-fixed the crash when setting the xNormal path.

//version 0.6.1
-added Smoothing group and Tangent/Binormals options for the FBX export.
-fixed FBX Triangulate problem when using an older plugin verison (FBX 2011 and before)

//version 0.6
-cage support added (custom and maya envelope)
-fixed a bug with the clear button (now working when nothing is selected);
-added preset support

//version 0.5
-curvature and prt map added
-n-gon filter added when exporting meshes
-fixed some misspellings
-added a new Tab : settings for the different maps
-fixed errors with the creation and the writing of the xml file
-fixed error when fbx plugin is not loaded (export automaticaly in obj)
-changed the export button to 2 button (one side HP mesh, other side LP/Blocker)
-new export maps added (height map, PRTpn, Curvature, Base texture)
-new options to force the writing of the xml file
-added an option to automatically convert HP from smooth preview to geometry at export

//version 0.4
-Xml file automatically generated in the export folder (when not already existing)
-n-gons detector on the low-poly before export
-fbx update : support update 2013 of the fbx plugin

//version 0.3
-Fix for the changes in the FBX command
-Fix for the blocker exporter, now really working

//version 0.2
-Initial version
-Support XML generation + xNormal export

Replies

  • throttlekitty
    Options
    Offline / Send Message
    Lovely, thanks!

    Do we need to suffix with _hp if the highpoly is within the same scene?
    Will you include an option to export a low poly cage?
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Do we need to suffix with _hp if the highpoly is within the same scene?
    Nope, only if the HP is not in the current scene.
    Will you include an option to export a low poly cage?
    By low-poly you mean a cage for the low-poly mesh ? If yes then yes I will include this in the future.
  • SPYFF
    Options
    Offline / Send Message
    SPYFF polycounter lvl 10
    Sweet! Good thing for Maya users.
  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Pretty nice Froyok, I may check it once I get my maya license back.
  • InProgress
    Options
    Offline / Send Message
    InProgress polycounter lvl 14
    Awesome work, Froyok!
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    thanks pretty nice, havent used it yet, but a good feature could be to have it automatically place the xml file, into the export path.

    in may case i always export to the projects data folder, so maybe when firring up the script it could copy the xml there etc.

    also the out of scene HP thing is pretty cool.
  • romy
    Options
    Offline / Send Message
    romy polycounter lvl 12
    Very useful, good job froyok thanks =)
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    passerby wrote: »
    in may case i always export to the projects data folder, so maybe when firring up the script it could copy the xml there etc.

    also the out of scene HP thing is pretty cool.
    It's possible, I will see how I can do that.
  • Sean VanGorder
    Options
    Offline / Send Message
    Looks great man! I'll be trying this out at work this week.
  • schneller
    Options
    Offline / Send Message
    schneller polygon
    Thanks Froyok, looks handy!

    Are you planning to let the user use xNormal's ray distance calc tool via the plugin? I use that a lot for baking simple things, so it would be a nice feature.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    schneller wrote: »
    Are you planning to let the user use xNormal's ray distance calc tool via the plugin? I use that a lot for baking simple things, so it would be a nice feature.
    I'm not sure if it's possible, not all the simple tools are available with a batch. I will try anyway.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    http://eat3d.com/forum/questions-and-feedback/batch
    Nope, currently only the simple ao tool and the typical render process can be triggered using the command line.
    Hmmm, looks like it's not possible.
  • EarthQuake
    Options
    Offline / Send Message
    Froyok wrote: »
    By low-poly you mean a cage for the low-poly mesh ? If yes then yes I will include this in the future.

    Yeah or the "envelope" as maya calls it. Its easy to export the cage from max with the default .SBM exporter but I haven't figured out a way to do it in Maya, would be really useful.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    EarthQuake wrote: »
    Yeah or the "envelope" as maya calls it. Its easy to export the cage from max with the default .SBM exporter but I haven't figured out a way to do it in Maya, would be really useful.
    The SBM exporter for maya doesn't have an option for exporting the envelope with the LP mesh. From my tests however it's possible to export it as a separated mesh. So the process will be similar in the end (mesh in SBM, cage in OBJ, something like that).
  • throttlekitty
    Options
    Offline / Send Message
    Maya (afaik) always looks for a [meshname]EnvelopeShape in the scene first before creating a new one, could probably script from that. As-is, I typically export both as obj separately. (and I totally forgot about sbm until your post, thanks)

    Also, by default, envelopes get added as a child to the original, which does bork up exporting as obj until you separate them.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Maya (afaik) always looks for a [meshname]EnvelopeShape in the scene first before creating a new one, could probably script from that. As-is, I typically export both as obj separately. (and I totally forgot about sbm until your post, thanks)

    Also, by default, envelopes get added as a child to the original, which does bork up exporting as obj until you separate them.
    Yep I saw that, but it's not a problem, some quick lines in the script and it will works as expected. ;)
  • Bertmac
    Options
    Offline / Send Message
    Bertmac polycounter lvl 17
    Nice very nice tool
    thank you so much.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    dont know much about the batch xnormal thing, but is there a way to just enter the ray distance from the maya script, and maybe sometime down the road build a maya tool to calculate it?
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    I noted that the "export" button doesn't work for the blocker file, I will fix the problem as soon as possible. For the moment you have to export it manually.
    passerby wrote: »
    dont know much about the batch xnormal thing, but is there a way to just enter the ray distance from the maya script, and maybe sometime down the road build a maya tool to calculate it?


    You can already set the ray distance (the Ray parameters on the UI). Otherwise, the ray calculator in mel is a bad idea. MEL is too slow for doing manual raycast. At least I don't have found native functions for that.
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    trying this out at work now. i loaded up my hp and lp (multiple objects) as groups. set my export path, then hit export. i get this error
    // Error: FBXExportCharacter is now deprecated. Use FBXExportSkeletonDefinitions. //
    
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    Froyok wrote: »
    I noted that the "export" button doesn't work for the blocker file, I will fix the problem as soon as possible. For the moment you have to export it manually.




    You can already set the ray distance (the Ray parameters on the UI). Otherwise, the ray calculator in mel is a bad idea. MEL is too slow for doing manual raycast. At least I don't have found native functions for that.

    maybe in a month or 2 when i got lots of free time, i might start working on prototypeing a calculator in python, than moving it over to c++ if it works and i need to speed boost.

    even just plain old python, using the maya.cmds is faster than mel, iv been building a my own smd exporter for the source engine in python, and it even with it's limited functionality functions way faster than the current mel one that is floating around.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Oniram wrote: »
    trying this out at work now. i loaded up my hp and lp (multiple objects) as groups. set my export path, then hit export. i get this error
    // Error: FBXExportCharacter is now deprecated. Use FBXExportSkeletonDefinitions. //
    

    Yeah, it's because my FBX plug-in is a 2012 version, it looks like some commands were changed since this version. I have updated my version and the script to fix that. Also funny fact : the command in the doc is "FBXExportSkeleton" (which doesn't work).

    I also noted that the command "FBXExportFileVersion" which I use to set the FBX file format version will be disabled in a next update. Great. :shifty:

    Haaaa, Autodesk...


    Anyway, here is the updated script : https://dl.dropbox.com/u/13564647/maya/frox_0-3.zip
    (No new features, only bug fix)
    passerby wrote: »
    maybe in a month or 2 when i got lots of free time, i might start working on prototypeing a calculator in python, than moving it over to c++ if it works and i need to speed boost.

    even just plain old python, using the maya.cmds is faster than mel, iv been building a my own smd exporter for the source engine in python, and it even with it's limited functionality functions way faster than the current mel one that is floating around.
    Well, if you could do that it would help not only this script but an other one that I'm working one (my retopo tools).
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    Ya would be willing to try my hand at it but I wouldn't expect anything too quickly, I got pretty long work weeks, for the next while, and something like this would require a lot of research on my part even before I write any code.

    Still would be a fun little project that can teach me a new side of 3d.
  • Gheromo
    Options
    Offline / Send Message
    Gheromo polycounter lvl 11
    I get this when I try to export

    // Error: Cannot find procedure "FBXExportSkeletonDefinitions". //
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Gheromo wrote: »
    I get this when I try to export

    // Error: Cannot find procedure "FBXExportSkeletonDefinitions". //
    Update your FBX plug-in : http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775855
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    so this is a bit odd. i am able to do everything just fine within the tool except bake. once i set my meshes and all my paths, i hit Bake Texture(s) and then see the xnormal launch window.. then very quickly (i really have to try to see it because it goes so fast) i see the render window open and close, along with an error window that typically arises when baking. i check my output and no textures are found so naturally would think something is amiss either with xnormal (which typically i have no problems with) or something im doing in maya

    also changing my xnormal path crashes maya.
  • Gheromo
    Options
    Offline / Send Message
    Gheromo polycounter lvl 11
    xnormal set to use CUDA render?
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Oniram wrote: »
    so this is a bit odd. i am able to do everything just fine within the tool except bake. once i set my meshes and all my paths, i hit Bake Texture(s) and then see the xnormal launch window.. then very quickly (i really have to try to see it because it goes so fast) i see the render window open and close, along with an error window that typically arises when baking. i check my output and no textures are found so naturally would think something is amiss either with xnormal (which typically i have no problems with) or something im doing in maya
    Do you have n-gons ?
    xNormal launch itself but close if there is an error. Try to launch xNormal normally and test your mesh. Unfortunately the batch render doesn't send/display the errors so I'm unable to warn the user when their mesh are not conform.

    I plan to do a manual checker (a least to prevent the n-gons) directly in maya when you export, but I didn't have the time currently to do it.
    Oniram wrote: »
    also changing my xnormal path crashes maya.
    This is not normal, I will see why this is happening.
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    a bit more enlightening info on this matter.. i decided to try this again in a new scene and it came back with an error.
    // Warning: file: C:/Users/smarino/Documents/maya/scripts/froXno.mel line 647: fopen: unable to open file "C:/Users/smarino/Desktop/WorkingFolder/textures/base.xml" for mode  "r". //
    
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Sorry I was very busy these last days and I did not yet fixed the current errors of the script. Your new error is very strange, I don't understand it : why the script try to to open the xml file on your desktop ? Did you modified the script ?

    [EDIT] Ha, I get it, do you have put the xml file inside you export directory ?

    Anyway, the new version will get rid of that, the xml file will be generated from the script itself. Again, I'm sorry for the bugs, I should have waited before sharing it. :\
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    So here is an updated version, I have fixed some bugs :

    https://dl.dropbox.com/u/13564647/maya/frox_0-4.zip
    //version 0.4
    -Xml file automatically generated in the export folder (when not already existing)
    -n-gons detector on the low-poly before export
    -fbx update : support update 2013 of the fbx plugin

    Some features are mussing, but I'm very busy on an other project, sorry guys. :S
  • MichaelElphick
    I haven't used this yet but looks like this will speed up my workflow tremendously! Thank you!
  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    Hey, Froyok - great tool.
    But I am having the exact same problem as Oniram. Everything works fine until I hit Bake textures. xNormal launches then immediately closes after displaying an error message for about .0001 seconds.
    EDIT : by timing a printscreen I was able to capture the exact message that pops up right before xNormal closes. Turns out it's just the normal baking progress bar. No idea why it aborts.
    wlWdF.jpg
    Baking the exported files manually in xNormal works fine. It's just that baking using the script doesn't work.
    Checking the maya output, it shows this error:
    No xml file, generating it...// Warning: file: C:/Program Files/Autodesk/Maya2012/scripts/froXno.mel line 704: fopen: unable to open file "C:/Users/Daniel/Desktop/froXno Test/base.xml" for mode "r". //
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    If xNormal close immediately, it's because it can't find a file most of the time (sometimes you forget to export before generating the textures, etc.).

    In you case, it's totally my fault. The last zip file had an error, I have fixed it and updated the archive. Can you re-download it and reinstall the script ?
    (To be precise : xNormal try to load the "base.xml" file, but since the version 0.4 I have changed the name of the xml file to "export.xml" and I forget to update every mention of it inside the script. it should be ok now.)
  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    Froyok wrote: »
    If xNormal close immediately, it's because it can't find a file most of the time (sometimes you forget to export before generating the textures, etc.).

    In you case, it's totally my fault. The last zip file had an error, I have fixed it and updated the archive. Can you re-download it and reinstall the script ?
    (To be precise : xNormal try to load the "base.xml" file, but since the version 0.4 I have changed the name of the xml file to "export.xml" and I forget to update every mention of it inside the script. it should be ok now.)

    Yep, new version works! Awesome tool, man!

    Minor issue, but if you do not have the fbx plugin loaded, exporting will not work. Even if you're only trying to export objs.

    Haven't tested to see if it works in reverse (if you have to have the obj plugin loaded in order to export fbx's)
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Ha yeah, I never test in the script if the export plugins are loaded. I can add a warning about that...
    I'm glad to read it works finally ! :)
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    can you add options to export a curvature map? I've found the gray-scale output of this to be very useful.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    chronic wrote: »
    can you add options to export a curvature map? I've found the gray-scale output of this to be very useful.
    I will ! :)
  • wolver
    Options
    Offline / Send Message
    can you add an option for a cage : ]
    I find I need cages for most of the baking I do
    fantastic tool otherwise
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    excellent! yes it works now. :D thanks a lot for the updates. I agree with wolver, an option for a cage would be highly appreciated (since i think xnormal is kinda pointless without it)
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    New version available :

    froXnormal 0.5

    Download : froXno version 0.5
    frox_05.jpg

    Changelog :
    //version 0.5
    -curvature and prt map added
    -n-gon filter added when exporting meshes
    -fixed some misspellings
    -added a new Tab : settings for the different maps
    -fixed errors with the creation and the writing of the xml file
    -fixed error when fbx plugin is not loaded (export automaticaly in obj)
    -changed the export button to 2 button (one side HP mesh, other side LP/Blocker)
    -new export maps added (height map, PRTpn, Curvature, Base texture)
    -new options to force the writing of the xml file
    -added an option to automatically convert HP from smooth preview to geometry at export
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    wolver wrote: »
    can you add an option for a cage : ]
    I find I need cages for most of the baking I do
    fantastic tool otherwise
    Oniram wrote: »
    excellent! yes it works now. :D thanks a lot for the updates. I agree with wolver, an option for a cage would be highly appreciated (since i think xnormal is kinda pointless without it)

    The cage support is planned for the 0.6 version.
    However, I'm not an experienced user of cages. I would like some informations on how you make them/use them. I have also planned the support of presets. This will also users to share settings between you maya scenes.
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    coming from max cages were typically auto generated through the projection modifier, but essentially all it was is geometry duplicated and pushed out along its normals (i believe maya calls this an envelope in transfer maps). what ive been doing as a temp thing for maya is just that.. duplicating my geometry and selecting the faces, using transform component to push it along the normals, then exporting it separately.

    as far as i know, SMB files support both a low poly and cage, but i have no clue how thatd work, since xnormal had its own .sbm export option for max. may be worth looking into though.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Oniram wrote: »
    coming from max cages were typically auto generated through the projection modifier, but essentially all it was is geometry duplicated and pushed out along its normals (i believe maya calls this an envelope in transfer maps). what ive been doing as a temp thing for maya is just that.. duplicating my geometry and selecting the faces, using transform component to push it along the normals, then exporting it separately.

    as far as i know, SMB files support both a low poly and cage, but i have no clue how thatd work, since xnormal had its own .sbm export option for max. may be worth looking into though.

    I see. I have done the same process in the past. I was wondering if you had some specific manipulation with them.

    The SBM exporter for maya doesn't show any option for cages unfortunately :

    1351128525-maya_sbm.jpg

    But exporting the cage as a separate file and using it as-is in the script will not be a problem. :)
    Let me some days and you will have it !
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 18
    Liking the idea of this project a lot. I'll give it a try when you get cage support. That's one given reason I sometimes use xnormal instead of transfer maps.
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    kodde wrote: »
    Liking the idea of this project a lot. I'll give it a try when you get cage support. That's one given reason I sometimes use xnormal instead of transfer maps.
    If you can, could you explain a bit you workflow with the cages ?
    Maybe my question can sound silly, but I would really like to understand how you guys use them to be sure to integrate them correctly.
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 18
    Froyok> When I specifically want to handle the projection rays associated with certain faces. To resolve inwards-falling normal map detail, or even sometimes to resolve "wavy lines".

    When making a custom cage I usually just duplicate the lowpoly. Move all vertices along their normals and then tweak certain faces that need to deviate from the regular "inflation".
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    I see. I think I was imagining something much more complex.
  • Gheromo
    Options
    Offline / Send Message
    Gheromo polycounter lvl 11
    Never heard of blockers for xnormal, can anyone explain what is it and what should I use it for please?
  • Froyok
    Options
    Offline / Send Message
    Froyok greentooth
    Blockers are simple mesh (like planes) that you use to block the rays of xNormal when you bake. It can be useful to avoid errors between fingers when the distance is very small for example.

    Blockers.png.ashx
13
Sign In or Register to comment.