请见Demo: Rendering & Art
这里模拟了青苔慢慢生长茂盛蔓延和消失的动态过程
上述效果的fragment shader代码(生成于自我的效果编辑器):
fragment shader code:
#version 300 es
precision mediump float;
precision mediump int;
uniform sampler2D u_sampler0;
uniform sampler2D u_sampler1;
uniform sampler2D u_sampler2;
in vec2 v_uvs;
layout(location = 0) out vec4 fragOutput0;
uniform vec4 fV4U_0[1];
void main()
{
vec4 result4_1 = vec4(0.0);
vec4 color4;
color4 = texture(u_sampler0, v_uvs.xy);
result4_1 = color4;
result4_1.xyz = normalize(result4_1.xyz);
result4_1.xyz = pow(result4_1.xyz, vec3(4.0));
result4_1.xyz = result4_1.xyz * fV4U_0[0].x;
result4_1.xyz = clamp(result4_1.xyz * min(pow(result4_1.xyz + 1.5,vec3(2.0)) - 2.0, 2.0