Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Location
    California, Utah, and Washington
    Posts
    3,070

    Texture alignment

    Way back in the day, there was a fantastic texture alignment tool built into the build engine. Let's say you had a series of walls all with the same texture. You go to the one furthest to the left, scale and pan it to what you want, and then simply press the "." key and it would scale and pan every wall to the right of that wall (that touched the wall) so they all had the same texture scaling, and each wall's texture was panned so that it lined up exactly with the wall to its right. It didn't matter what angle the wall bent to, what its size was, etc.

    Is there any way to have maya do a feature like that?

    It shouldn't actually be a hard feature to implement; it is only simple math. Granted, results might not come out correctly if you have a lot of faces that connect at differing angles, like a sphere, but the calculation itself should be a simple algorithm. From a starting (planar) face, note the relative scale of the UVs. Have all faces match this scale. Then move adjacent face's uvs to line up with the UVs of that face, either directly sown together or positioned so that a repeating tile would line up perfectly. Then systematically move through each face that connects with any of those faces with the same alignment pattern until all faces are aligned.
    Logically, it wouldn't be aligned perfectly on three dimensional corners where a face shares edges with faces that come in a different order, but for many situations this would align a lot of surfaces very quickly.

    Right now I'm building a series of hallways with brick walls. The pattern needs to be properly aligned around corners. I know of no alignment tools that would keep those corners aligned properly, at least not without having to then come in and start connecting each face's UV or otherwise align each face individually.
    Read my Webcomic:
    maytiacomic.com
    Check up on my progress at:
    marscaleb.com

  2. #2
    Join Date
    Feb 2005
    Location
    /..
    Posts
    2,587
    ...it is only simple math, ...the calculation itself should be a simple algorithm;
    Cool pop up the math and I'll give you a hand turning into MEL

    Can you post up any pics of this happening in 'the build engine'?
    There is an exception to every rule, apart from this one.

  3. #3
    Join Date
    May 2006
    Location
    California, Utah, and Washington
    Posts
    3,070
    Okay, you got me in that I don't actually *know* the math, I just mean to say that I can conceive of it. It requires three-dimensional operations that I never studied, but relative to that sphere it is simple math Adjusting the relative scale would be the only complicated equation, and then its a simple function of adding the UV coordinates so they line up.

    Well anyway, here's some shots of what I was talking about. I made a quick crude example in build.
    I used a computer-board tile since it has a clear repeating pattern.

    I've got totally crazy walls, going in all kinds of directions, heights, and the textures are scaled and panned to all different sizes and positions.
    The wall on the far left, however, is correctly aligned in the way I want it.

    And here it is after I apply the alignment tool:
    tool:
    Technically, the tool doesn't actually adjust scale, so I had to work a little cut-and-paste magic to get all the tiles stretched to the same amount, but that doesn't really matter. The end result is that each of these walls have their textures lined up properly. Any particular texel is at the exact same height on each wall, and on each corner, the next wall starts at the exact texel where the last wall stopped.

    This was just one single tool, issuing one single command.
    (Technically the tool in build didn't handle all the walls at once, but this is just to avoid recursive problems with the double-sided walls it uses in its geometry. But that's besides the point.)

    That's the tool I want in Maya. I select a series of adjacent faces, designate a starting face that is already aligned properly, and they all line up exactly to match that starting face.

    Now let's look in maya. I've made a simple shape for demonstration purposes, but as you can see the textures are not aligned properly:


    If I tried, say a planar alignment, I can get that first face to look properly, and the second face IS aligned correctly so the texture does continue where the other left off, but it is scaled wrong. As you can see here:

    This is why I say "relative scale." I don't know what the real term is, but we are working in three dimensions. I don't know what terms to use, other than to say "this is what you'd expect from an object in real life. If you took wallpaper and wrapped it around a corner, you'd expect the pattern to look exactly the same on each surface if you looked directly at that surface."

    So the first thing the alignment tool is pretend that the face is coplanar with the starting face. This would make the UVs line up with the same relative scale of the starting face.
    Like so:


    Now for this simple example, this would make that second face already lined up exactly properly, and the UVs are sewn together for good measure. I suppose I don't have to complicate it further, even though I did in my original plan. But basically the process would go to each successive face and align all the selected tertiary faces which connect to that secondary face (and have not been aligned already) and apply the same process to them: give them the same relative scale and move the UVs so they are aligned and sewn together.
    If a face was not planar, it would just grab the UVs for the tri's that make it up and run them as if they were faces.

    This is what the final alignment should look like:


    Conceivably, the faces don't even need to be connected. If there is a gap between them, Maya would just create an imaginary face that covers the gap, (like the bridge tool, only it pretends the geometry exists instead of creating it,) calculate the same process for this dummy face, and then use that dummy data to calculate the UVs on the detached face. It could also conceivably apply this tool to faces on multiple objects.

    Personally, I would think that if I had a texture that repeated a lot, which I would for a wall, the UVs of each face do not necessarily need to be sown directly to its adjacent face, which would have UV coordinates sitting way out in the middle of nowhere, but it could add/subtract those coordinates by whole numbers until they are within the -1 to +1 range. But that's just a personal preference.

    Honestly I would expect this tool to exist already. I recall watching tutorials on how to set up the UVs on a character mesh, and a tool that could recursively align and sew faces to the same exact size would save an immeasurable amount of work. And I just want it so my bricks bend around the corner properly.
    Last edited by Marscaleb; 08-05-2013 at 02:08 AM.
    Read my Webcomic:
    maytiacomic.com
    Check up on my progress at:
    marscaleb.com

  4. #4
    Join Date
    Dec 2009
    Location
    Brooklyn, NY
    Posts
    501
    I get what your saying. Maya forces you to do more work with uvs than you want to. As for texturing then manipulating your object, I don't think that's the solution. Putting the work in to unwrap and model is what you eventually have to do. You want it to tile, snap those uvs to the grid. If its a lot of this work that you have to do then Maybe it would be worth looking at an external program for laying out your uvs.
    The unexamined life is not worth living.

    Follow me on Twitter

  5. #5
    Join Date
    Oct 2013
    Location
    Muscat, Oman
    Posts
    4
    This is actually a bit difficult to design. I have always been having problems with aligning all the textures in the perfect positions. I have planned a special class for this. I have to be perfect before I do this again.





    -----------------------------
    CORBIN GRAVELY
    NIOS Admission
    ----------------------------
    Last edited by pondshus2; 04-05-2018 at 12:29 AM. Reason: Changed Profile Data

  6. #6
    Join Date
    Jul 2003
    Location
    N/W uk
    Posts
    211
    You might want to consider the problem in 2D firstly:
    ie: draw out the walls as a Spline, 3 point curve, etc. so you have a birds eyeview of the floor (like an AutoCAD drawing)
    then all you need to do is either copy and move the line to the height of the ceiling ((input X) going 3D),
    Connect the dots (Corners (input Y))
    and the Walls /planes should be Y up and UVs at the default?
    Then the texture should repeat across or along the newly created wall if stacked on top of each other in the UV editor?
    Just a thought, it might get you going on the right path?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •