我正在尝试使用此处找到的噪声函数在片段着色器中创建超级简单的 Perlin 噪声云。
在低八度音阶时,我的输出是,因为缺少更好的词,“blobby”。我只是想平滑这些斑点区域并具有平滑的噪音,但它比一个八度音程更详细一点。
片段着色器:
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 resolution;
// Noise related functions go here ..
float surface3 ( vec3 coord ) {
float frequency = 4.0;
float n = 0.0;
n += 1.0 * abs( cnoise( coord * frequency ) );
n += 0.5 * abs( cnoise( coord * frequency * 2.0 ) );
n += 0.25 * abs( cnoise( coord * frequency * 4.0 ) );
return n;
}
void main( void ) {
vec2 position = gl_FragCoord.xy / resolution.xy;
float n = surface3(vec3(position, time * 0.1));
gl_FragColor = vec4(n, n, n, 1.0);
}
现场示例: http:
//glsl.heroku.com/e#1413.0
左边是我现在所拥有的。我怎样才能实现更符合正确图像的内容?