Home Technical Talk

Bleeding your textures past UV borders

polycounter lvl 18
Offline / Send Message
Silva_Spoon polycounter lvl 18
I am using 3dsmax's Render to texture to transfer Normal, Diffuse, Spec and lighting maps from my detail mesh to my render mesh. Problem is that there is no "bleeding" of textures past the UVs so when I view the model in engine. I see the seams all black and ugly when it gets mip-mapped. I was told that there is a plugin for photoshop that will look at each layers color information and find the "borders" (areas with no color information on the layer) and fill the area around the borders with what ever the closest color to the border. Hope that made sence. So it would like grab all the pixels on the borders of a layer and stretch it so many pixels. I was wondering if any of you know about it or where I could find it.

Also, is there like a rule of thumb to follow when bleeding textures past UV borders so you cant see seams when a texture is mip-mapped? Like if the texture is 1024x1024 make sure you bleed the textures "___" pixels past the border, if the texture is 512x512 bleed the textures "___" pixels past the border.

Or am I talking crazy and everyone is scratching there heads thinking wtf is he talking about?

Replies

  • poopinmymouth
    Options
    Offline / Send Message
    poopinmymouth polycounter lvl 19
    Well you can just check pixel border and make sure it's on 2 or greater. Make sure not to save the preview that pops up, because it's a post effect, so it only shows up on the flat that got saved to your hard drive, not on the window that pops up.

    Also both Pior, and myself made photoshop actions that would do what you want, mine is at work, but I'll upload it tomorrow.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Max's render to texture has always put the extra edge border around for me.

    Try changing the "Edge Padding" number in the RTT dialog window - I think default is 2, maybe you should try it higher.

    As for using Photoshop, you can do this using the Maximum (or Minimum, I always get those two mixed up!) filter.

    Just select your unused space, grow the selection by 1 pixel (so it's only selecting the very outer row of pixels on all your UV borders, then do a Maximum (or Minimum) filter on it, set to an appropriate number - 2 or 3 usually does it for me.

    Edit: And yes, Poop beat me to it, but that reminds me - I used to save out Max RTT things from the preview window, and always wondered where the edge padding went. It saves it on the hard drive, but doesn't show it in the preview window, so maybe that's what you're doing...?
  • poopinmymouth
    Options
    Offline / Send Message
    poopinmymouth polycounter lvl 19
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    hello spoon

    For the first part of your question : what I'd do is grab the magic wand, set it to zero tolerance and no blending, and selct the outside bit of the UV chunks (or maybe max esports alphas with rtt? not sure)

    >ctrl+i to then invert the selection

    >ctrl+j to duplicate its content, two times

    >blur the lower copy a bit (small gaussian blur will do)

    >and make multiple copies of the blurred layer to thicken all that. That should do it... You can then do it again with a larger value.

    I did an action for that some time ago, I've also herad someone else did it before... But hey that can be quickly done by hand anyways.

    As for the second part of your question, well I guess it depends on how close together your UV chunks are?

    Hope this helps
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    YOU BOTH BEAT ME TO IT! Suckers laugh.gif
  • Silva_Spoon
    Options
    Offline / Send Message
    Silva_Spoon polycounter lvl 18
    Where would I be without fine polycounters like yourselves? Thanks guys!
  • Eric Chadwick
    Options
    Offline / Send Message
    I wrote an Action that does it little differently, using the Minimize filter. I just fixed it, it wasn't using the blur, so I was getting stretchy pixel-smearing. Thanks for the blur idea. This one makes a 4-pixel border, as a new layer. You can use it if you like.
    http://www.ericchadwick.com/examples/files/uv_edge_filter.zip

    Poop I'd like to see what you did. Different from pior's approach?
  • poopinmymouth
    Options
    Offline / Send Message
    poopinmymouth polycounter lvl 19
    I was using an advanced heuristic algorithm.
  • Eric Chadwick
  • Eric Chadwick
    Options
    Offline / Send Message
    FWIW, updated the file.

    Works better with CS & PS7 (thanks Jay!).
    Fixed when current layer != Front layer.
    Added comment about non-AA selection.
    Fixed layer-naming problem.
  • Jay Evans
    Options
    Offline / Send Message
    Jay Evans polycounter lvl 18
    I did this by mistake somehow by importing my texture into zbrush. Applying it to my model, and then exporting the texture. Not sure what I did, you're results may vary:p
  • guplik
    Options
    Offline / Send Message
    guplik polycounter lvl 19
    MoP wrote: »
    but that reminds me - I used to save out Max RTT things from the preview window, and always wondered where the edge padding went. It saves it on the hard drive, but doesn't show it in the preview window, so maybe that's what you're doing...?

    This. This fixed it for me. Graaaaah, bloody Max :D
    I've just been looking for ways to improve my edge-bleeding Photoshop macro, but just getting RTT to save my textures did what I needed!

    I thought I'd better thank this three-year-old thread ;)
  • CheeseOnToast
    Options
    Offline / Send Message
    CheeseOnToast greentooth
    Xnormal also comes with a tasty photoshop script that can do the same thing, and works very well. Worth a mention in this now undead thread. *BRAAAAINS*
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    jesus neal i knew you were gothy but this is downright necromancy!
    also congrats on your new first post, may it be the start of a whole new era of guplicity!
  • Eric Chadwick
    Options
    Offline / Send Message
    Wow, I need to remove that action, so slooooow.
  • doc rob
    Options
    Offline / Send Message
    doc rob polycounter lvl 19
    aahh, holy crap. For a second there I was like "POOP IS BACK!" Stupid thread necromancy. We need a feature where if a post was over a year ago it looks like it's covered in cobwebs.
  • anoon
    Options
    Offline / Send Message
    EDIT: Wow, I just noticed this is an ancient thread. Oh well.

    You already have some answers, but I will share my method: The edge padding function of Render To Texture should do this for you.

    The rule of thumb I use for calculating edge padding is this:
    Ask youself which mip map level you expect the model to be seen at in game, for the majority of cases.

    Over the years, I have found that A good rule of thumb is an asset (such as a character,) has to look good all the way through to the 128x128 mip level.

    Therefore, you need at least 2 pixels of edge padding at 128x128, IF you can guarantee that your UVs are snapped directly to the pixel boundaries of your UV space. (More on this later...)

    Therefore, if your texture size is 1024x1024, you need account for 16 pixels of edge padding at 1024x1024.

    Now: Snapping to pixels. The best way to ensure that your UVs are snapping directly to pixels is to enable the grid and grid snap in the UVW Unwrap dialog. Then, set your grid spacing to a size equivalent to the number of pixels in the map. This is easily done by dividing UV space by the number of pixels: 1.0 / 128pixels = 0.0078125 grid. Now with grid snap enabled, as long as you snap your UVs to the grid, you can be sure you are snapping pixel by pixel.

    I use this method extensively. So much so that I have expanded my UVW Unwrap dialog to include a set of buttons that automatically set the grid space to pixel density equivalents from 8x8 up through 4096x4096!
  • EarthQuake
    Options
    Offline / Send Message
    you're all fools! xnormal installs a ps plugin that you can use to do pixel-padding. lolol old thread
Sign In or Register to comment.