Looking for suggestions on dripping rain shader
Hello everyone, I'm working on a shader to make it appear that a surface is dripping water. I'm using a Panner to scroll the normal maps and a light diffuse down to make it appear that water is running down the surfaces. However it flips direction based on the UVs. It looks like I'm going to have to build a third UV set just for this texture because it would be inefficient for all vertical surfaces to be aligned in the UV space.
So here's my question; does anybody know of a way that I could use a material to correct this problem? I was messing around with World Position, Object World Position and Object orientation but I couldn't get the result I needed. I'm not worried about the tops of surfaces just the sides. Does anyone have any suggestions?
Object world position can work. ObjectWorldPosition, componentMask off r ang g (or others depending on whic direction you want), multiply by a very small 2 vector like .05,.05, and plug that into your uvs on a texture. That's the gist anyway. Hope that helps. Search for posts by me. One of them shows a shader chain usiing objectWorldPosition as the uv coordinates.
It doesn't seem like that technique can alter or ignore the direction of the UVs' unfortunately. I've been messing around with it a bit (great technique for reducing repetition, btw!) and I still have the rain running sideways in some spots.
I wonder if making the rain overlay a decal would be a better solution than building it into the shader for the object? Or I just have to make new UVs for anything that is intended to use it... ugh...
It should ignore uvs if you don't transform to local/tangent space. It will only work for one direction though.
Last edited by 3dimentia; 08-27-2010 at 03:09 AM.
Also, this is a world space PROJECTION, so if the face isn't flat it will look as if it is being bent around the object. Obviously, if your object is more or less flat, this won't be an issue. If the object has eaves, and bends etc, then it will be. If you need picture/pixel perfect here, then you'll need to do something else, like you suggested above. I would really hate for you to have to have three UV sets just for this. I don't know......if you have GOW 1, can you look at their rain level to see how they did it?
OK, so I might be two years too late for you - but I came across the same problem and found a solution.
If you look in UDK's pre-made Material Function library, there is a function that applies your material to your object using cylindrical UVs.
By taking out the parts that are relevant to you and putting it into your own Material, you can add the TexCoordinates that it produces to a Panner expression.
Therefore, you have a Panner that moves relative to a cylindrical UV unwrap - completely independently to your object's actual UVs.