I want to create the effect of rain falling on and running down a glass roof.
I understand I can use the glass refractive shader that’s in the Pro Standard Assets and create an animated tiling texture that shows rain drops and water trickling downwards.
I don’t know how to add an animated tiling texture to a shader though. Does anyone have any ideas?
Rain running down glass is a complicated effect, so it’s probably best to get your animation from somewhere as a loopable and tileable video, and then use it as a MovieTexture in the normal map of one of the Pro glass shaders. Unfortunately, I’m not familiar enough with 3D modelling packages to know how you’d generate such a video. Also, I don’t believe you can import videos as normal maps automatically in Unity, so you’d have to make it a normal map ahead of time.
OK, that’s a start. You can just add a movie file to the normal map in the shader? I had no idea. Do you know of any documentation anywhere about this? I haven’t found anything in the manual or the Wiki yet.
Again, this approach doesn’t support tiling the animation on an object. Unless you’re Ok with having each frame stretched across the entire roof, you should use a MovieTexture or some other approach.
I’ve used both these methods but I don’t think either are suitable to this particular application because of the scale of it.
My understanding is that you can animate a shader texture. I’ve been looking into it this evening and I think that’s how they do the water shaders but I don’t know exactly how it works and I can’t find any documents.
Thank you, I think that’s exactly the sort of thing I was looking for. I’m just looking at the Sewer Demo and that has a scrolling script for the waterfall texture that I think works the same way as what you are suggesting. I’m going to try and apply it to my scene and then adapt it.
Hopefully.
It also has a refraction shader that’s not in my set of Pro Standard Assets which I’m going to try too.
In the basement how did you go about implementing the rain and the splashing when they hit a collider? Would you be willing to share the code for this?
I have made a half arsed attempt to add rings but it doesn’t work very well if you look closely as I haven’t figured a way yet to get splashes and rings attached to the same collision but this is because I have no scripting background, I’m from the Art side.
I’m currently taking a Java Script course but have discovered even doing my own accounts for the first time was easier than my homework (how do you get a hexadecimal number to doc.write as a colour and is this advanced for week three of a two hour a week course?) so it may be some time before my rings and my splashes line up.