Need help making wet/rain shader

Started by
8 comments, last by SuperVGA 10 years, 10 months ago

I have just started learning how to write shaders, and written a few simple ones (Diffuse specular etc). But I still don't have the skills to reach my original goal of writing a wet/rain shader. If anyone can point me in the right direction that'd be great. Working in Unity3d BTW.

Advertisement

I'm thinking I'm going to need some sort of height map to decide where the water would pool up, and also something for ripples for when the rain hits. I don't have much experience, and I'm practicing writing a normal shader right now. If there any suggestions about learning shaders that would be helpful for this one, that would be really helpful.

I think there was an AMD demo a while back that showed off parallax mapping with cobblestones, and it was used for rendering a rainy street scene. You can check that out as a source of ideas for how they did it - I believe Natalya Tatarchuk was the author of the presentation that I read.

Sébastien Lagarde is writing some fantastic articles about this on his blog

Some ideas / tricks I used in the past:

A mix of particles and camera locked rain sheet cones. We used an offline generated rain mask / top down heightmap to mask out rain drops in occluded areas. We also used that texture to place rain drop splash particles on the surfaces, which refract the scene buffer.

then increase colour saturation and change specular settings on materials, also applying additional scrolling normal maps for dripping water, displacing them in the approximated "down" direction. I used our sky hemisphere precomputed occlusion factor to fade the impact of these effects.

If you already have reflection support, you will also want to increase reflectivity on wet sufaces. Finally, lighting rain drops works really well. An easy way of doing that is to push lighting data into a low-ish res volume texture, diffuse through volume, and just texture fetch for the rain particles.

I think there was an AMD demo a while back that showed off parallax mapping with cobblestones, and it was used for rendering a rainy street scene. You can check that out as a source of ideas for how they did it - I believe Natalya Tatarchuk was the author of the presentation that I read.

Exactly. I was really impressed by that one back when it came out. Still am, to be frank.

It's the AMD (ATI, actually) "

">Toy Shop" Tech demo

I found a couple of slideshows on it, but no actual shaders or explanations of their approach. sad.png

http://developer.amd.com/wordpress/media/2012/10/ToyShop-Eurographics_AnimationFestival.pdf

http://www.ati.com/developer/gdc/2006/GDC06-Advanced_D3D_Tutorial_Day-Tatarchuk-Rain.pdf

http://developer.amd.com/wordpress/media/2012/10/Tatarchuk-Rain.pdf (A little more technical)

I found this though! Seems like an interesting read! (It's a whole series on wet weather stuff - maybe you should read from its first page!)

EDIT: Looks like I relinked to the blog Yourself mentioned a link to. My bad.

There is also a sample by NVIDIA in D3D10, but I think it's more about particles rendering http://developer.download.nvidia.com/SDK/10/direct3d/samples.html#rain

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

Awesome! I'm going through everything now, but wanted to thank everyone more responding first.

So after a bit of research, the shader would have to cover: Diffuse, Normal, Specular, Height, Flow Maps, Cubemap, Vertex Blending, Phong-Blinn, Porosity. Does this sound about right?

Work hard. Become something.

So after a bit of research, the shader would have to cover: Diffuse, Normal, Specular, Height, Flow Maps, Cubemap, Vertex Blending, Phong-Blinn, Porosity. Does this sound about right?

It won't *have* to. You can probably get by with using only a few of those, but as with so many things, it's a trade-off.

Also, I'm not sure why you're mentioning both types of light, lighting models, the application of flow maps and cube maps. And where would you apply porosity?

This topic is closed to new replies.

Advertisement