Sign in to follow this  

How to make textures move?

Recommended Posts

I have generated some 2D noise (Perlin) textures that I map to a sphere. But is there someway to make these 2D cloud like textures move? I was thinking about generating two different sets of texture coordinates and then use these in the fragment program to lookup in each of the textures but I am a bit unsure on how to work out the details.

Share this post

Link to post
Share on other sites
In my sky dome, I keep the normal texture coords (stored in VBO) I generate when i make the dome, when rendering I just simply also pass a uniform vec2 call offset, which I offset the current texture coordinates by.


uniform vec2 offset;
varying vec2 texCoord;

texCoord = glMultiTextureCoord0;
texCoord += offset;

I usualy just calculate my "offset" by incrementing each frame based on time passed.

this should give you a very simple cloud movement, using some things like a sine wave, you could get a more realistic movement than simply rotating around the sphere.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this