This is one of my favorite shaders. It was really challenging implementing it the first time i read Valve’s GDC paper on the subject, but I’ve gained a bit of understanding since then. It is super useful for not only water, but particles as well, like smoke and fire. While UV offsetting and flip-book textures will get you somewhere, flowmaps will get you even further in terms of variation between particles. Pretty much anything you want to look fluid like but don’t want to pay fluid costs for is a great candidate for flowmaps IMO.These shaders implement the full suite of techniques described in the original presentation by Valve. This includes the pulsing fix, debris flow, and normal intensity modification. It also runs off of vertex colors by default but you can change that in the pixel shader. Hope you like it!
Here we have Schlick’s specular on the left and phong on the right both with a “specular power” of 40. As you can see the highlight spreads out somewhat but the core follows essentially the same shape as with phong. Some might even find this preferable to phong, as perfectly sharp highlights can seem artificial. The cool thing is this technique could be applied to other things that use power as well, which could save you some instructions to spend elsewhere. For example, this should work equally well for a blinn shader.

Maya CGFX File:

phongnormalflowmap.cgfx
File Size: 6 kb
File Type: cgfx

Download File


Unity SHADER File:

phongnormalflowmap.shader
File Size: 9 kb
File Type: shader

Download File


Leave a Reply

Your email address will not be published. Required fields are marked *