2D value noise built from a hash function
Polar coordinate twirl and time-based advection
Layered noise for smoke detail
Smoothstep thresholding for soft density bands
旋涡烟雾
旋涡烟雾 Volume Shader 中的「Preset overview」重点说明:2D noise-based swirling smoke pattern. 这部分适合用来判断 shader 复杂度、浏览器图形路径和 GPU 稳定性。
实际测试时,请固定浏览器、预设、窗口大小、电源模式和热状态;如果页面变得卡顿或设备发热明显,应降低复杂度或停止运行。
性能因素
Noise layers
比较 Volume Shader BM 结果时,应固定浏览器、预设、窗口大小、电源模式和热状态;这些条件变化会直接影响 FPS 与 frame time。
Coordinate warping
比较 Volume Shader BM 结果时,应固定浏览器、预设、窗口大小、电源模式和热状态;这些条件变化会直接影响 FPS 与 frame time。
No ray loop
比较 Volume Shader BM 结果时,应固定浏览器、预设、窗口大小、电源模式和热状态;这些条件变化会直接影响 FPS 与 frame time。
可编辑参数
Twirl strength
比较 Volume Shader BM 结果时,应固定浏览器、预设、窗口大小、电源模式和热状态;这些条件变化会直接影响 FPS 与 frame time。
Noise scale
比较 Volume Shader BM 结果时,应固定浏览器、预设、窗口大小、电源模式和热状态;这些条件变化会直接影响 FPS 与 frame time。
Smoke threshold
比较 Volume Shader BM 结果时,应固定浏览器、预设、窗口大小、电源模式和热状态;这些条件变化会直接影响 FPS 与 frame time。
#version 300 es
precision highp float;
out vec4 outColor;
in vec2 v_uv;
uniform float u_time; uniform vec2 u_resolution;
float hash(vec2 p){p=fract(p*vec2(123.34,345.45));p+=dot(p,p+34.345);return fract(p.x*p.y);}
float noise(vec2 p){ vec2 i=floor(p); vec2 f=fract(p); f=f*f*(3.0-2.0*f);
float a=hash(i), b=hash(i+vec2(1,0)), c=hash(i+vec2(0,1)), d=hash(i+vec2(1,1));
return mix(mix(a,b,f.x), mix(c,d,f.x), f.y);
}
void main(){
vec2 uv = v_uv;
vec2 p = (uv*2.0-1.0);
p.x *= u_resolution.x/u_resolution.y;
float r = length(p);
float ang = atan(p.y,p.x) + 0.8*sin(u_time*0.5) + 2.5*r;
vec2 q = vec2(cos(ang), sin(ang))*r*1.5 + 0.15*u_time;
float n = noise(q*3.0) + 0.5*noise(q*6.0);
float smoke = smoothstep(0.35, 0.9, n);
vec3 col = mix(vec3(0.05,0.08,0.12), vec3(0.8,0.9,1.0), smoke);
outColor = vec4(col,1.0);
}