Home Unreal Engine

Fresnel \ Rim lighting

polycounter lvl 18
Offline / Send Message
FAT_CAP polycounter lvl 18
So - I have just started looking into UDK\ UE3 again and am familiarizing myself with the material editor.

Im knocking up a character shader and have a slight fresnel effect going on to give a subtle rim-light to the character. This looks OK but falls down a little when the underside of objects are lit as brightly as the top side. What I would like to do is to mask the fresnel by the normal direction - so basically not have the fresnel effect on anything that is facing downwards.

Does anybody have any idea how I would go about this? None of my attempts so far have given me good results and my maths\ programming brain isn't up to scratch enough yet to really pick apart how to do this in UDK (or if it is even possible).

Replies

  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    This really reminds me I need to continue my shader for artist articles... the next one I wanna write would explain this to you perfectly. But yeah that doesn't help you much as it's not there yet.

    What you want to do is create a mask for the top/bottom thing. Based on a calculation the compares the surface normal with a set upward pointing vector. You'd basically do a Dot product between the surface vector and a transformed (tangent to world) upward pointing vector. Dot products always come out in ranges between 1 and -1 with normalized vectors, so gotta adjust for that (clamp). Might have to invert it too. Once you have that mask, multiply with the fresnel mask to get what you want.
  • FAT_CAP
    Offline / Send Message
    FAT_CAP polycounter lvl 18
    Wow - quick reply! Thanks Laurens :)

    All of that makes sense when I read it, but isn't immediately apparent to me how I would transfer that to UDK material nodes... Im a noob I know! I'll have a play around and see what I can get working and post back here my results if I get stuck.
Sign In or Register to comment.