Creating seams for realistic textile renderings

Hey I'm currently working on a project to make photorealistic clothes of various kinds. I've modeled a piece of clothing fairly detailed but i'm stuck on the best/fastest possible solution to create the seams. Some renderings will show the clothing piece very close-up and show the seams. and the model has to work for both full view and close-up.

So far I've tryed several different approaches with various results.

Creating a tiny seam object, and manually placing THOUSANDS of these along the edges is way too time consuming and tideous.

Layered texturing - but since the curvature of the clothing is quite complicated at some parts using projections and UV mapping it looks kind of wierd in some parts, and easily becomes just as complicated and tideous as placing objects.

Paint FX doesn't really have the tools i need, but would be the easiest approach if i could figure out how to create a Paint FX brush on my own, but there is very little information about this, and i can't seem to find any tutorials about it.

Is there any easy way to draw splines on a polygon surface, and use an approach based on that?

Any recommendations on how to create those seams easily would be much appriciated.

Thanks

Paint FX doesn't really have the tools i need

it does.

Is there any easy way to draw splines on a polygon surface, and use an approach based on that?

paint effects is based on splines on polygons of sorts. It is possible to do its just a bit convoluted, havent tried this for ages tough. But yes thats the way i would approach this.

and manually placing THOUSANDS of these along the edges is way too time consuming and tideous.

howabout PAINTING texture projections in with artisan?

i ve done such thing recently and i found the best solution in distributing seam objects along my seam curves (i created them on a live made cloth object). After messing MUCH around i used a camera with aim and up vector which i moved along the seam curves (not using snapshots but per script based on curve length to avoid uneven distribution). The orientation of the camera via up i got with a closestPoint node from the out normal direction of the cloth surface, the aim was bound a bit ahead from the camera to the seam curve. Iam not claiming thats the perfect solutiuon in a way of efficient maya usage but the result was quite satisfying. Unfortunately i didnt made a shareable script but if you do not find a better solution i could have a look and make something usable out of the fragments and up it here.
Maybe andrehitsoy reads this thread and puplish a incredible script out of nowhere, just wait :wink:

Maybe andrehitsoy reads

well yeah he a beat me to the array script, i was just publishing one and doing final testing (see, i had the same problem as he had, but offcourse thet was a subtle bug by me anyway*) when he pushed his version so i didnt see any point in puhing my own solution altough it IS 40% shorter.

Anyway im glad i dont have to be the only one writing the script examples here, as it was a while back. Seems like this site is puhing up some new talent to take over. Heh maybe than i can retire :stuck_out_tongue:

am not claiming thats the perfect solutiuon in a way of efficient maya usage but the result was quite satisfying

it should work.

  • so that means i have better quality control? Or is it that im worse, since it was a bug in my quality control in first place?

yes since highend3d went comercial this site suffers a certain brain drain...

Naah i dont think its that, its tghe fact that it coencided with a hiring spree of sorts. But could be.

Dont know if the thread starter still messes with getting good seams but meanwhile i also played al ittle bit around with this and put together some lines, maybe others also have use for it, anyway.
It roughly works like described above, although it now uses a locator bound to a motion path which has the world up vector linked to the surface normal of the "cloth" object. The motion paths U parameter handling is set to fractional length so the distribution of seam objects is absolutely even. The locator carries the seam object to all specific curve divisions and creates a duplicate, done.
It outputs the seam objects in two types: as simple copys or as instanced objects (by a particle instancer). However if the instancer is used the seam objects transformations will be set to zero first, and so its harder to adjust rotation afterwards.
Usage:

Parent all members (cloth object, seam curve and seam object) to world space first to avoid unpredictable results (means that seam curves must not be of type curve on surface, convert them into a regular curve first).
Move the seam object to the start(!) position of the seam curve and add select (in this order) "cloth" surface / seam curve / seam object
and execute the script with following switches:

distributeOnSurface(int $numObjects, int $alignToSurface, int $useInstancer)
//example: distributeOnSurface 100 1 0

where $numObjects is obviously the count of seam objects, $useInstancer (meant as bool) does like said above and $alignToSurface (also meant as bool) fixes a the following issue: if creating nurbs curves on a live made surface they become parented under the nurbs surfaces parametric space and thus align perfectly on the surface and make up good seam paths, but using meshes this wont work as precisely. The curves would have different distances to curvy mesh surfaces at different curve locations so the seam objects would submerge into the surface or stand away. So the closest point of the cloth surface is token to set up the seam object location. However the spacing between each neighbour point on surface doesnt match the spacing of the curve divisions so using align to surface might produce uneven seam object distribution. If you want to create prefect seam curves on meshes you can use the "polyNurbsIntersect" script here from maya download section, it can create intersection curves from a nurbs surface with a mesh surface.

global proc distributeOnSurface(int $numObj, int $alignToSurface, int $useInstancer)
{
    cycleCheck -e off;
    string $sel[] = ls -long -sl;
    string $moLoc[] = spaceLocator;
    string $moPath = pathAnimation -fractionMode true -follow true -worldUpType "vector" $sel[1] $moLoc[0];

    string $infoNode[], $infoAttr[];
    string $shape[] = listRelatives -children $sel[0];
    if(nodeType $shape[0] == "nurbsSurface")
    {
        $infoNode[0] = createNode closestPointOnSurface;
        $infoNode[1] = createNode pointOnSurfaceInfo;
        connectAttr -f ($sel[0] + ".worldSpace[0]") ($infoNode[0] + ".inputSurface");
        connectAttr -f ($sel[0] + ".worldSpace[0]") ($infoNode[1] + ".inputSurface");
        connectAttr -f ($infoNode[0] + ".parameterU") ($infoNode[1] + ".parameterU");
        connectAttr -f ($infoNode[0] + ".parameterV") ($infoNode[1] + ".parameterV");
        $infoAttr = {($infoNode[0] + ".inPosition"),($infoNode[0] + ".position"),($infoNode[1] + ".normal")};
    }
    else if(nodeType $shape[0] == "mesh")
    {
        loadPlugin -quiet "nearestPointOnMesh";
        if(! pluginInfo -query -loaded "nearestPointOnMesh") error("unable to load nearestPointOnMesh.mll");
        $infoNode[0] = createNode nearestPointOnMesh;
        connectAttr -f ($sel[0] + ".outMesh") ($infoNode[0] + ".inMesh");
        $infoAttr = {($infoNode[0] + ".inPosition"),($infoNode[0] + ".position"),($infoNode[0] + ".normal")};
    };
    connectAttr -f $infoAttr[2] ($moPath + ".worldUpVector");

    vector $rotatePP[];
    string $positionPP[], $dObj[];
    for($i=0;$i<$numObj;$i++)
    {
        setAttr ($moPath + ".uValue") ((1.0 / ($numObj - 1)) * $i);
        float $p0[] = `xform -q -ws -t $moLoc[0]`;
        setAttr $infoAttr[0] $p0[0] $p0[1] $p0[2];
        float $p1[] = `getAttr $infoAttr[1]`;
        if($i == 0)
        {
            if($useInstancer) makeIdentity -a 1 -t 1 -r 1 $sel[2];
            $dObj = `duplicate -rr $sel[2]`;
            parent $dObj[0] $moLoc[0];
        };
        if($useInstancer)
        {
            if($i == 0)
            {
                appendStringArray $dObj `duplicate -rr $sel[2]` 1;
                 move -r (0 - $p0[0]) (0 - $p0[1]) (0 - $p0[2]) $dObj[1];
                makeIdentity -a 1 -t 1 -r 1 $dObj[1];
                connectAttr -f ($sel[2] + ".rotate") ($dObj[1] + ".rotate");
                connectAttr -f ($sel[2] + ".scale") ($dObj[1] + ".scale");
                setAttr ($sel[2] + ".template") 1;
                setAttr ($dObj[1] + ".template") 1;
            };
            $rotatePP[$i] = `xform -q -ws -rotation ("|" + $moLoc[0] + "|" + $dObj[0])`;
            if($alignToSurface) $positionPP[$i] = $p1[0] + " " + $p1[1] + " " + $p1[2];
            else $positionPP[$i] = $p0[0] + " " + $p0[1] + " " + $p0[2];
        }
        else if($i >= 1)
        {
            string $newObj[] = `duplicate -rr ("|" + $moLoc[0] + "|" + $dObj[0])`;
            $newObj = `parent -w $newObj[0]`;
            if($alignToSurface)    move -r ($p1[0] - $p0[0]) ($p1[1] - $p0[1]) ($p1[2] - $p0[2]) $newObj[0];
        };
    };

    if($useInstancer)
    {
        string $particleObj[] = eval("particle -p " + stringArrayToString $positionPP " -p ");
        addAttr -ln userVector1PP -dt vectorArray $particleObj[1];
        addAttr -ln userVector1PP0 -dt vectorArray $particleObj[1];
        for($i=0;$i<$numObj;$i++)
        {
            vector $r = $rotatePP[$i];
            particle -e -order $i -at userVector1PP -vv ($r.x) ($r.y) ($r.z) $particleObj[1];    
        };
        saveInitialState $particleObj[1];
        particleInstancer  -a -obj $dObj[1] -rotationUnits Degrees -rotationOrder XYZ -p worldPosition -r userVector1PP $particleObj[1];
    };

    delete $moLoc[0] $moPath $infoNode;
    select $sel[2];
};

// as always use at your own risk of loosing scene data, exploding workstations etc.

Thanks for great feedback. I'm currently looking to buy this plugin that seemed to have everything I need.

Stitch from Ticket01 seems fairly easy. Anyone tryed it out?

http://www.ticket01.com/products/stitch/stitch/videos.html

I think if you going to do much with cloth you should buy it, its more comfortable (refering to the videos, i did not try the plugin for my self) and faster than using some self made scripts, thus it may be worth the money. But otherwise the procedure above does exactly the same so you could save the bucks for this and go shoe shopping with your wife.

Well i think overall its a good ide to keep in mind that buying is a 2 edged sword, as is not buying.

Buying is often a one way street, once you buy your forced to buy forever. And usually more stuff. On the other hand a well placed buy makes you MUCH faster, you can get whet you need in a timnely fashion. On the otherhand doing it yourself may be a much faster alternative, the caveat is that if you never make anything then you will not be able to do so in atimely fasion.

BUt then you must be aware thet all theese methodologies can be extended further. Why exactly do you need to do your own work yoursef? Cant you just buy it form india? And in the other extreme why buy anything at all since you could make everything yourself. Well in reality you dont have time or will to do either of theese.

Its all a big tradeof, IF you can make do with a script please do. It makes you more proficcient and self sufficient and furtehrs you more. On the other hand buy IF you can really afford it, because you should be able to get enough money to actually be able to pay for stuff thet furthers your work more than when you do it inefficently, if not your screwed anyways.

PS: the real advantage is that the bought products is a node. The disadvantage is that you need one licence of this per seat you intend to use the node ON. possibly also including your render nodes.

PPS: nowayfra you should make yours into a node too. And oh you just destroyed someones busines :slight_smile:

...if they call for it.

Thanks again for the feedback.

I'm not very comfortable using a lot of scripts, and I'm defenatly not a coder. This massive project involves a LOT of clothes being made in a realistic way with a lot of seams, so the pricetag isn't that much of a problem. :slight_smile:

Wish i had more time to learn some scripting, but for now i think have to go with the plugin, but the example from nowayfra is really impressive. Wish i had the skills to come up with something like that.

I'm not very comfortable using a lot of scripts,

A plugin is basically jsut that, a lot of scripts bundled in way that makes somebody else own a part of your pipeline. Here the plugin while polished is not really any rocket science, now the advantage of a script is that you can take it further when the need arises. So when you buy focus your attentiuon to the support your original author gives to your product because otherwise you might find yourself not able to upgrade your maya in timely fashion when you need it.

and I'm defenatly not a coder

Well most scripters arent coders either. Its virtually impossible not to know how to use maya and not know how to script things. I mean sure the users might not be able to type a script but all maya users know how to make a script, because thats all maya is a massive script engine that turns your gui actions into script.