Specular Conductivity + Cubemap shader

My specular “conductivity” shader for Unity3D is more / less complete.

These shader posts are odd. For non-devs they may seem like voodoo, but for the technical artists amongst my circles I’m sure these are obvious and simplistic examples.

An illustrative screenshot for the cubemap version isn’t as straightforward since the cubemap influence is subtle when appropriately applied.

The image attached shows an object set to appear as gold, at least correctly on the top and incorrectly on the bottom (to demonstrate the cubemap). On the bottom, you can see the ceiling tiles being reflected more clearly, as well as a portion of blue sky (skylight in the center of the ceiling). Those elements exist in the top version, but are more subtle.

I’m pleased with the difference from the simpler specular shader. Just a hint of reflection sells the surfaces well.

I struggled with this update of the shader. Until I realized the cubemap should desaturate somewhat as the conductivity rises: otherwise some strange blended colors can occur. My solution may or may not be physically correct, but it does seem to work consistently (so far).

I’ve also included a cubemap influence slider, for easy adjustments.

More could be added to this, such as a normal map, etc., but I think I’ll leave this as my last post on my first shader. =)

Here’s the shader code, in Shaderlab + Cg / HLSL (for Unity3D):