Valve's Implementation looks quite nice, but requires 3 texture samples as far as i can tell, so i tried to emulate the visual effect while only taking a single sample at a low mip level and adjusting it in the shader. It comes quite close, although Valve's implementation's colors are a bit richer. A good improvement would be to bake out a low res cubemap based on Valve's implementation and then save that into the lowest mip level of the cubemap where you could access it directly, but that's a little beyond the scope of this demo.
Valve's implementation is enabled by default, but you can re enable my single pass attempt in the shader.
Maya CGFX File:
phongnormalambientcube.cgfx |
Unity SHADER File:
phongnormalambientcube.shader |