Home Technical Talk

Shader - Sharpen Texture/ Detail/Color Project Process?

polycounter lvl 12
Offline / Send Message
Ace-Angel polycounter lvl 12
Heya peeps, how are all you mighty fine looking of PC doing?

I have question pertaining to sharpened textures and how I would go about in certain levels.

1- Would it be possible for me to get a texture and get rid of all of it's details and instead sample nearby generic detail for it?
Example of what I mean is say I have Square which is blue, with black lines and brown colors outsides. I would like to get rid of the black lines and instead feed it either blue or brown colors (naturally, this is a simple case, I was wondering to what extent is it possible on more complex textures)

Basically, imagine 'bleeding' out colors in a texture so that they all mush together like a nice tomato soup.

2- Would it be possible to 'sharpen' a texture? Basically just up the ante and polish certain parts of the texture from a somewhat degraded texture in shader form?

3- Is there a way to 'project' colors on a model in Object Space? What I mean is I would like to take a cube, and for example, project brown to the left, red to the right, etc.

Basically, imagine a cubemap like deal where I project colors on each face manually, is this possible?

(I use UDK, but I'll also be happy for code snippets!)

Cheers!

Replies

  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    No.3 is definitely possible. Reflection vector->transform tangent to world->dot product with a world space vector->clamp to 0.0 to 1.0->multiply by the colour you want->emissive. It's basically lighting.

    If you're talking about doing this in Max or something, just stick a light source to the right and bake a lightmap, that'll build a mask.
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    Nr1 I'm not sure i understand ? You can easily get saturation levels from a texture and use that to determine which pixels are more colored. You can also easily blur those pixels together, and then combine those again with the original, desaturated levels-adjusted version (to get back the black lines). But I can't really imagine what you want...

    Nr2, doing an unsharp mask is pretty easy. Just look the math up on Google, it's only a few simple operations.

    Nr3 is indeed simple as well. JamesWild mentions Reflection vector, but i don't think you need that. You just need to do a few lerps between the directions, using the object space normal as Lerp alpha (making sure it's in a proper 0-1 range).
  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    I couldn't see an obvious way to find the object space normal in the UDK material editor - I put together a rough spherical environment map material yesterday (I'm not allowed to use cubemaps and have some panoramas mapped to UVspheres) and the only thing I could find was to take the reflection vector and run it through a transform.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Thanks guys for the quick replies!

    1- Xoliul, that's pretty much the idea, problem is I don't want to blur it in the traditional sense since I don't have to access my LODbias, or even box-blur, I basically want to fake blur my texture through some kind of bleeding process of the colors from one pixel to another. Basically what you said, but without any of the more 'robust options' if you get my gist.

    2- Is Unsharp mask the best option? I was taking a peak at it earlier, but it involves a box-blur and I would like to avoid that ( http://searchco.de/codesearch/view/10359412 )

    3- Ah, cheers guys, I got it now, Mask out each direction color that, and Lerp feed the colors, by using the Reflection in World Space, cheers!
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    There's not much else except Box blur or LODbias if you want to blur an image.
    And yes Unsharp mask works fine and is pretty easy to do. As far as i know all sharpening is going to require blurring.
  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    I'm not sure reflection is the right one to use now I've looked into it more thoroughly after Xolihul's message. It appears to be distorted at the edges - the normal used for specular lighting. (averaged between surface normal and surface-eye normal?) If you're using no normal maps feed a 0, 0, 1 vector into the transform input and if using a normal map feed that in.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Cheers guys, much appreciated!

    Yep, that's it James, that's how UDK does it ;P
Sign In or Register to comment.