Home Unreal Engine

Rain Slicked Surfaces

polycounter lvl 7
Offline / Send Message
feanix polycounter lvl 7
I'm trying to created a material that can be applied to any object and have a panning rain normal wash down its surface. Basically, I'm trying to make it look like water is running over the object.

A simple solution would be to simply have an additional UV map. However, in this case, I don't want to rely on that for two reasons:
1) It would mean that every model in the game would require an extra normal map.
2) If you have an object that needs to be used in many orientations then in all but one orientation the direction of the flow of water would be wrong.

I would be satisfied with something that looks basically like a cylinder map. So U going around the circumfirance of the object and V going from the top to the bottom. I'm not hugely concerned about the seam that would create because the effect would be subtle.

I'd like to avoid using a vector Transform as that will disable vertex colours (which I want so that the rain effect would be vertex paintable).

Does anyone have any approaches that I could look into? I've already tried the ObejctOrientation node, it was a bust. :(

Replies

  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    feanix wrote: »
    Does anyone have any approaches that I could look into? I've already tried the ObejctOrientation node, it was a bust. :(

    Open up the example night and day transition map in UDK. It has examples of this exact thing.

    You should just be able to use a world position node as UVs to make water run downwards.
  • feanix
    Options
    Offline / Send Message
    feanix polycounter lvl 7
    Aha! Thanks sprung, that's exactly the kind of thing that I was looking for! I've managed to isolate the chunk of the material tree that creates this effect:

    7R6UR.png

    Panning
    Orientation Masks
    Normals Blending
    Unknown

    It seems that the approach here is to create three planar UVW 'projections' and then blend them all together.

    I've marked one section as "unknown" because I'm not sure exactly what it does. It seems highly likely that its purpose it to actually create the UVWs that the three different projections use. In fact, as I write this, I suspect that's EXACTLY what they do.

    The panning section seems straight forward but it's not terribly clear to me why they did it this way instead of just using a panner.

    The orientation masks seem to be creating two greyscale masks, one for the horizontal and the other for the vertical that can be used to control the blending.

    The actual blending section does just that with a bunch of lerps.

    EDIT: There's a huge limitation with this workflow, of course: Tranform nodes kill your vertex colours. If anyone can think of a way to do this without vertex transform I swear to have / not have (delete as desired) their babies.
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    the bit you've marked as "unknown" is the world position node scale. because if you just used the world position node raw your "faked" UVs will be the same size as the world - so they have that node to control the tiling. In this case the 'rain' bitmap will be 64 units wide in the world.
  • feanix
    Options
    Offline / Send Message
    feanix polycounter lvl 7
    I assume that's not ALL the "unknown" section is doing, though, right? It's also providing the basis for the UV coords?
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    feanix wrote: »
    I assume that's not ALL the "unknown" section is doing, though, right? It's also providing the basis for the UV coords?

    Yes - that's what world position node is doing. The other two nodes are to scale the coordinates into a managable size.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Uv coord are no different mathematically than world coords or for that matter, colors. They're all vector values. So you can use world coords for a texture because xyz is analogous to uvw. The scaling factor is as sprunghnt mentioned it sizes the texture sample to 1/64world units wide and tall.
  • Oniram
Sign In or Register to comment.