niform sampler2D baseMap;
uniform float time;
varying vec2 rm_Texcoord;
const float speed = 2.0;
const float bendFactor = 0.2;
void main( void )
{
float height = 1.0 - rm_Texcoord.y;
float offset = pow(height, 2.5);
offset *=(sin(time * speed) * bendFactor);
vec3 normalColor = texture2D( baseMap, fract(vec2(rm_Texcoord.x + offset, rm_Texcoord.y) ) ).rgb;
gl_FragColor = vec4(normalColor,1.0); //texture2D( baseMap, rm_Texcoord );
}
uniform float time;
varying vec2 rm_Texcoord;
const float speed = 2.0;
const float bendFactor = 0.2;
void main( void )
{
float height = 1.0 - rm_Texcoord.y;
float offset = pow(height, 2.5);
offset *=(sin(time * speed) * bendFactor);
vec3 normalColor = texture2D( baseMap, fract(vec2(rm_Texcoord.x + offset, rm_Texcoord.y) ) ).rgb;
gl_FragColor = vec4(normalColor,1.0); //texture2D( baseMap, rm_Texcoord );
}
本文介绍了一种使用GLSL着色器实现的纹理变形效果。通过改变纹理坐标,使纹理产生随时间波动的视觉效果。该效果依赖于高度值和时间变量,使纹理在垂直方向上产生波动。
3951

被折叠的 条评论
为什么被折叠?



