Rob*_*yon 5 shader glsl webgl fragment-shader
我正在尝试使用此处的Noise函数在片段着色器中创建超级简单的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);
}
Run Code Online (Sandbox Code Playgroud)
实例:http :
//glsl.heroku.com/e#1413.0

左边是我现在所拥有的.如何才能使用正确的图像实现更内联的内容?
最简单的方法是去掉表面函数中的两个噪声调用。只留下第一个噪音呼叫线,你会得到看起来像第一个的东西:
http://glsl.heroku.com/e#1450.0
多倍频程噪声中的尖锐线条来自使用abs(),删除abs()并将其替换为噪声值的平方或执行类似0.5*(1.0+cnoise())的操作(如果cnoise输出在-1之间) ..1)。
这是一些摆弄的结果 http://glsl.heroku.com/e#1450.1