PDA

View Full Version : texture perturbation/distortion via fragment program



Alessandro_dup1
04-22-2004, 03:11 PM
I have difficulties finding references about the assembly-like instructions you use in a fragment program. I have a very simple shader that modulate two textures. All i want now is to perturbate (or disturb) the texture coordinates, i.e. with a sin wave equation. I don't know where to start from. Here is the code i have now:



!!ARBfp1.0
ATTRIB inTexCoord = fragment.texcoord[0]; # First set of texture coordinates
ATTRIB inColor = fragment.color.primary; # Diffuse interpolated color
OUTPUT outColor = result.color;
TEMP tex0;
TEMP tex1;
TEX tex0, fragment.texcoord[0], texture[1], 2D;
SUB tex0.x, tex0.x, 0.01;
TEX tex1, fragment.texcoord[0], texture[0], 2D;
MUL outColor, tex0, tex1;
KIL tex0.x;
ENDI tought i could setup a timer "importing" it from the opengl pipe glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_A RB, currTime, 0, 0, 0);
and then to use a sin function or something related to the timer, in order to get a dynamic effect. But i'm stuck.

Any idea ?

mikael_aronsson
04-22-2004, 11:04 PM
I don't think the beginners forum is the best place for this question....