Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Qarl Linden's Maya export script

Erik Bligh
Registered User
Join date: 25 Feb 2006
Posts: 27
07-12-2009 17:21
I'm trying to use Qarl Linden's export script in Maya, and I feel like I'm doing something wrong. I have the 32x32 test sphere selected in object mode and type in "sculpt" in the command line. (Yes the .mel file is in the right folder). It returns as the result something like "sculpt sculptor sculptStretchOrigin" and no input box comes up. Any ideas?
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-13-2009 04:50
Before I explain the right way to make this work, I'm curious. Where did you get the idea that typing "sculpt" in the command line was the right thing to do?

So you know, Maya already has an existing command called "sculpt", which has nothing to do with this subject. It creates a sculpt deformer, and applies it to the se|ected geometry.

The way to use Qarl's script is the same way you'd use any other MEL script in Maya. Paste it into the script editor, highlight the text, and hit Execute. Optionally, you can also save it to a button on your shelf, so you can just click on it whenever you need it. I've posted the basic instructions for this many times on this forum. Here it is again. Enjoy:


From: Chosen Few
NOTE: Steps 1-4 here are the setup steps for Maya itself. You only have to do them the first time. After that, the actual sculpty export begins on Step 5. So do 1-4 now, and then every time you export a sculpty hereafter, you can skip 1-4 and star directly on Step 5. Just don't skip them the first time, or it won't work.

1. Find the sculpty exporter script at http://wiki.secondlife.com/w/index.php?action=raw&ctype=text/javascript&dontcountme=s&title=LlSculpt_mel/sculpt.mel. Copy the text of the script from your browser window to a text file. Save the file as llSculpt.mel.

2. In Maya, open the Script Editor. You'll find the button for it all the way at the lower right hand corner of the screen. It looks like 3 stacked rectangles, a black one on top of two gray ones. Click the button, and the script editor will open.

3. In the Script Editor window, go File -> Open, navigate to wherever you saved llSculpt.mel, and open it. You can now either run the script directly from the editor, or save it as a button on the shelf, and run it from there. I'd suggest the latter. Step 4 explains how.

4. On the main menu bar (not the script editor's menu bar, the one at the top of the main Maya window), go Window -> Settings/Preferences -> Shelf Editor. The Shelf Editor dialog will open. Click on the Shelves tab at the top of the Shelf Editor dialog, and then click the New Shelf button near the bottom. In the Name field below, name your new shelf Second Life and press Enter. Then click on Save All Shelves, and close the Shelf Editor.

You should now see a new shelf tab near the top of your Main Maya window called Second Life. Click on that tab now. You'll see it has no buttons yet. We're about to add one.

Go back to the Script Editor. In the Mel pane, se|ect all the text from llSculpt.mel by pressing ctrl-A. At the top of the script editor, go File -> Save Script To Shelf. In the dialog that pops up, name your new shelf item llSculpt and click OK. You'll now see that a button as appeared under your Second Life shelf tab, called llSculpt.

Now, whenever you want to run the sculpty exporter script, you can just click that button. You'll never have to worry about performing steps 1-4 (unless a new version of the script becomes available, and you want to upgrade).

5. In your Maya scene, se|ect the sculpty object you want to export, and perform the following steps:

Edit -> Delete by type -> History
Modify -> Freeze Transformations
Modify -> Reset transformations
Edit -> Delete by type -> History

If you don't perform these steps, your sculpty will come out messed up. Its imperative that none of your objects for export have any transformations or history records on them. Maya must believe that the state they're in now is the state they've always been in.

6. Click the llSculpt button to open the Export Sculpt Texture dialog. Click the Browse button on the dialog to choose where you want to save your sculpt map(s), and to assign a name for the file(s). Set the X & Y resolution both to 64. Check the boxes for Maximize Scale and Correct Orientation. When you're ready, hit Export. Your sculpt map(s) will now be in whatever directory you specified.

7. In SL, upload the sculpt map(s) you just exported from Maya. Make sure you have it set to upload small textures losslessly. Otherwise compression artifacting will make your sculpt prims will come out lumpy.

8. Create a cube, and then on the Object Tab, change the prim type from Cube to Sculpt. Notice most of the numeric parameter fields on the object tab disappear to be replaced by a texture picker. Use that picker to assign your sculpt map to the prim.

If you did everything right, your object in SL should now look like your object in SL.


A few things to note:

1. If the sculpty doesn't look right in SL, either you didn't follow the above instructions properly, or you made the source object wrong in Maya. Remember, for sculpties, the best way to work is to make every object by deforming a NURBS sphere, torus, cylinder, or plane. Arbitrary objects won't work. Everything must have perfect topology, meaning each object must be a singular contiguous surface, unfoldable into a perfect rectangle. You can deform the shape to become anything you want, but don't tear the surface, and if you're using a sphere, don't open the poles. For best results, the surface should have 16 sectons and 16 spans.

2. The default topology for sculpties is spherical, but there are some other options, accessible in SL via the pulldown menu, just below the sculpt map field in the editor. These are torus, cylinder, and plane. If you plan to use them, your source object must match. In other words, a toroidal sculpy should start out as a torus in Maya. A cylindrical sculpty should start as a cylinder in Maya. A planar sculpty should start as a plane in Maya. Again, you can deform the shape as much as you want to become anything at all, but don't make any changes to stitching or opening/closing. The topology must remain intact. In all cases, 16 sections and 16 spans is the best resolution to work with.

3. As you start making more and more complex items out of sculpties, it won't be uncommon for one project to contain many different sculpt prims. It quickly becomes time consuming to upload all the maps, and apply them one at a time to each prim, and then try to place all the prims by hand so everything lines up. There is a more advanced sculpty exporter, which will generate baked textures and a script to instruct a program how to assemble the objects in SL.

You can find the advanced script and the assembly program at http://wiki.secondlife.com/wiki/Importprimscript

Be aware that the script makes use of the Maya software renderer to bake the textures, which is just about the worst renderer there is. I recommend allowing it to do its thing, just to make rudimentary placeholder textures, and then replace those textures later with ones baked by a better renderer. The best renderer on the market for this type of work is Turtle. If you can't afford Turtle, Mental Ray is will do a decent job. It will give you better results than the Maya software renderer, anyway.

4. Keep in mind that because the maps are generated by translating XYZ positional data to RGB color data, the precision is somewhat limited. The maps are using 8 bits per channel per pixel, which means there are only 256 possible values between zero and whatever maximum you're using, for each vertex. The larger the distance between vertices, the greater the margin for error. A sculpty in-world will almost never be an exact mathematical duplicate of the model it was sourced from. It will be a very close approximation, close enough that no one will likely notice the difference, but it won't be totally identical.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
valentine Biddle
Registered User
Join date: 22 Apr 2007
Posts: 79
Error
09-09-2009 00:29
Hello
when i try to export my sculpties i get this kind of error:

ERROR, Cannot open file C:/Users/Blahblah/Desktop/group|pasted__nurbsSphere1.tga; Invalid argument
ERROR, Cannot open file C:/Users/blahblah/Desktop/group|pasted__nurbsSphere1-surface.tga; Invalid argument

all in the Output window..

any idea how to solve this?? thanks in advance!
:)
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-09-2009 00:52
Sounds like you pasted an object into the scene, and it wound up the child of a group or of another object. The exporter does not understand heirarchy. All objects must be unparented. Open up your hypergraph, and if anything is shown below anything else, middle-drag it out from underneath, so that all objects are at the same level.

If you've been using groups to help keep things organized, consider using layers instead. Groups and other parentings are incompatible with the exporter, but layers are totally transparent to it.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
valentine Biddle
Registered User
Join date: 22 Apr 2007
Posts: 79
09-09-2009 01:00
riiight indeed i do not make a new cilinder every time, i just copy and paste the cilinder from a scene to an other... to be faster

so i may need to restart all? do u mean? i tried unparenting, and ungrouping
but i always get those messages:

// Error: Object, 'nurbsTorus1', is already a child of the parent, 'world'.
// Error: Can't ungroup leaf-level transforms

i'm not good with layers yet.. would be there a simpler solution??
valentine Biddle
Registered User
Join date: 22 Apr 2007
Posts: 79
Hypergraph
09-09-2009 01:09
ok found the Hypergraph
it does'nt look like i can move out something there...
Dante Breck
Spellchek Roxs
Join date: 29 Oct 2006
Posts: 113
09-10-2009 09:31
I had the same problem once quite a while ago and its exactly what Chosen said. I removed the items from groups but then also had to go and rename them to remove the characters in the names of the items since the script didn't like things like | in the names. Once I did that all was well.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-10-2009 10:34
Yes, get rid of all pipes, slashes, brackets, etc. from the names. You don't want anything that even hits that one item might be grouped underneath another. I'd even suggest getting rid of the word "pasted".

By the way, I don't recommend pasting objects from one Maya scene to another in the first place. It can get a little messy. Remember, every Maya scene is just one big relational database. You don't want to do anything that can risk breaking or orphaning file associations, input/output connections, node relationships, histories, etc. Import/export is much cleaner and safer than cutting & pasting.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
valentine Biddle
Registered User
Join date: 22 Apr 2007
Posts: 79
09-14-2009 05:24
yes but how??? is there a sequence of commands to use? maybe u can indicate me the process step by step?i have no idea, i tried my own but with no results..thanks if u can i would appreciate it