绘制的图像
源码
1 void main() 2 { 3 vec2 uv = TexCoords; 4 // 换算到[(-.5, -.5), (.5, .5)] 5 vec2 p = -0.5 + uv; 6 7 vec2 uvTemp = vec2(atan(p.x,p.y)/6.2832 + 0.5, length(p)* 0.4); 8 //uvTemp = vec2(atan(p.x,p.y)/6.2832, length(p)); 9 //uvTemp = vec2(atan(p.x, p.y) * 5.0, length(p) * 0.4); 10 float uv1 = atan(p.x, p.y) / 6.2832; 11 uvTemp = vec2(uv1, uv1); 12 13 float color = 1.0 - length(p); 14 color = 0.1; 15 //color =1.0 - length(p); 16 //color = 3.0 - 3.0 * length(p); 17 18 for(int i = 1; i <= 7; i++) 19 { 20 float power = pow(2.0, float(i)); 21 color += (1.0 / power) * noise_fractal(uv * power);// + noise_fractal(vec2(time * power)); 22 //noise_sum_abs(uv); noise_fractal(uv * power); noise ; value_noise 23 } 24 25 //FragColor = vec4( color, pow(max(color,0.),2.)*0.4, pow(max(color,0.),3.)*0.15 , 1.0); 26 FragColor = vec4(color, color * 0.4, color * 0.15, 1.0); 27 28 }
把各个函数在网格上绘制出来就一目了然了
关于噪音过程,推荐看看这篇 http://blog.csdn.net/candycat1992/article/details/50346469