kee*_*n3d 5 opengl glsl fragment-shader
我试图用正弦波扭曲圆的绘制,使其在 OpenGL 着色器中看起来像这样。
我发现了许多使用length
中心点半径来绘制圆的示例,但我无法弄清楚如何用正弦波对其进行调制以扭曲圆半径。任何帮助将不胜感激!
使用片段到中心的角度作为sin
函数的输入,并将结果添加到长度。
vec2 position = gl_FragCoord.xy - resolution / 2.0;
float color = smoothstep(2.0, 4.0, abs(length(position) - 50.0
+ sin(atan(position.y, position.x) * 4.0 - 3.141 / 2.0) * 7.0));
gl_FragColor = vec4(vec3(color), 1.0 );
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3948 次 |
最近记录: |