Home Technical Talk

Bake only hard edges in a UV texture.

polycounter lvl 11
Offline / Send Message
jocose polycounter lvl 11
I usually clean up my UV bake and use it to highlight all the hard edges on my model.

Is there some app or way that will only bake the edges that have split vertex normals?

I'm working in Maya at the moment, but I am actually curious if any app can do this, or if there is some quick trick someone has that's better than just hand editing the texture in photoshop.

Replies

  • Ben Apuna
    One way I've done it before is to export my UV layout as paths to Photoshop, then stroke the path with a brush. You can also restroke the path with a jittery eraser if you don't want very hard clean edges. Admittedly I'm sure there are some ways to optimize this procedure.

    I believe there is also a crazy bump trick to get nice highlights derived from your normal map, I'm sure you could probably do the same thing in Photoshop. I'm sure there's also a tutorial about doing just that around here somewhere.

    EDIT:

    Here ya go http://boards.polycount.net/showthread.php?t=52183
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    I hacked it by displaying only hard edges in the custom poly display menu, then just took a screengrab of my UV window. Not as good as a proper UV export though.

    @Ben : Sometimes it would be nice to just have the UV export just show hard edges. If you could export them as paths (ignoring the soft edges), it could be a real time saver and very accurate.
  • Ben Apuna
    @CheeseOnToast:

    Yeah I totally know what you mean. With my method you end up with a grid of useless lines that you have to then go in and erase. Like I said my workflow has a need for some improvements :)
  • Ben Apuna
    One thing I tried out in the past was to duplicate the model, then manually delete all the soft edges while keeping the UV shell intact. Finally export the remaining UVs as paths to photoshop. That method seemed like more trouble than it was worth though, maybe it could be scripted to save time.

    If all you want are the outer shell edges.

    Export your UVs as paths to Photoshop. Then right click that path layer -> Make Selection... -> Feather Radius 0, Anti-aliased checked, click OK. Then chose any selection tool -> right click the canvas -> Make Work Path... -> Tolerance 0.5, click OK. Now you've got a path layer called "Work Path" which represents only the outer shell UV edges provided that they are not right next to each other on the UV layout.
  • jocose
    Offline / Send Message
    jocose polycounter lvl 11
    Thanks a bunch for the replies guys. I was able to figure out a quick way of selecting only the soft edges by using the "Polygon Selection Constraint" window. All you have to do is specify smooth or hard edges only.

    However, this turned out to not be enough. Because if I delete all of the smooth edges it can destroy my UVs in some instances. I had a fairly complex object with some overlapping UVs that was pretty well optimized and it turned my UVs into a mess.

    Really the only way to do it seams to be taking a screenshot like CheeseOnToast suggested, but I don't know the best way to get a set resolution using this method. Also if you have a non-square texture like a 256x512 then you wont be able to use this method at all if your UVs are scrunched into the 0-1 range. Because normally I use the bake tool to bake out a larger texture that unscrunches my UVs for painting.

    It would be really nice if there was some slick way of doing this, still this is much farther than I had gotten. Thanks guys.
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    Also if you have a non-square texture like a 256x512 then you wont be able to use this method at all if your UVs are scrunched into the 0-1 range.

    There's a way round this bit at least. Assign a blank non-square texture in the right proportions, and then click the "use image ratio on/off" button in the UV window.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    I looked today into this and I might be able to script something in maxscript that would render selected edges with aliasing, so the lines would not be smooth just like a regular UV screen grab in max.
    I found some script snippets that select hard edges (smoothing group wise),- once those edges would be selected the script would have to convert them to UV edges - store them in an array - and then plot pixel line wise each UV edge of the array into a bitmap,- that bitmap could then be written to the clipboard or saved to disc as image.


    Another way would be to select the hard edges, convert to UV edges, swap UVW channel with Mesh XYZ channel. Back select the converted edges from the former UV channel now in the 3dspace - and convert the edge selection to a spline. Add another square spline around the extracted splines so that you have a prober bounding box, export as illustrator paths, import into PS and use it there.

    In booth cases the most vital part would be to select (script wise) the hard edges and convert them to UV edges. After that its a matter of execution and type.
  • Ben Apuna
    That sounds cool renderhjs. I'm in favor of the path based solution rather than the pixel based solution.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    pixel based would have the advantage of being the quickest. Just run the script and then instantly paste the clipboard into Photoshop.

    The spline solution is more accurate but requires a nasty workflow - like exporting the AI, import in PS, goto paths tab, right click on path,.... Sure you can record a macro for that but it still require more interaction.

    And if you want a trace template the aliased bitmap would be enough. Maybe a pixel radius attribute so that you can render different thickness levels - and then resize it using bicubic interpolation in photoshop so that the lines appear anti-aliased.
    A start point for the script could be this:
    http://www.scriptspot.com/3ds-max/hard-soft-edge
    but I am sure that I saw some direct edge selection of hard edges around here before,
    edit, perhaps this one:
    http://www.scriptspot.com/3ds-max/split-hard-edges
  • Eric Chadwick
    f-edge does a nice job of this in 3dsmax, and it's only $45.
    http://www.ddag.org
    1209017311_fedge.jpg

    For Maya... have you looked at the vector renderer? I bet there's also a toon-style shader for Maya that would give you lines along the hard edges...
  • Eric Chadwick
    As for selecting the hard edges in Max, maybe Neil Blevins' edgeSelectByAngle script might do the trick?
  • Eric Chadwick
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    I have been trying to RTT some ink 'n paint (smoothing groups + material ID'S) but needs a projection cage (because of the way the i&p rendering works) and it does not so often end up with use able results.
    Maybe I need to tweak more but I thought it was a nice idea,- scripting the whole thing into 1 button later is no problem but tweaking so it works is difficult. Now I am looking for other shader effects that put contrast on edges.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    made some experiments:

    texTools_3.0_edgemap_rendering.jpg

    as soon as I have something solid I will add it to texTools, related thread:
    http://boards.polycount.net/showpost.php?p=991072&postcount=471
Sign In or Register to comment.