Animating a cubemaps orientation

Hey All,

I want to add an animated “sheen” reflection to my puzzle game and I am thinking the best way to achieve this is through a cubemap. What I’d need is the ability to animate the cubemap’s orientation over time. Is this possible? I am using Unity Basic/iOS Basic.

Any information is greatly appreciated!

Thanks,

You’d want to rotate the view direction vector reflected by the surface normal (all normalized) with a quaternion passed in (as a shader parameter vector) representing the rotation you want.

Here’s some quaternion rotation shader code:

vec3 rotate_vector( vec4 quat, vec3 vec )
{
    return vec + 2.0 * cross( cross( vec, quat.xyz ) + quat.w * vec, quat.xyz );
}