Untitled
unknown
plain_text
3 years ago
708 B
7
Indexable
let vertexShader = `
varying vec3 vPos;
void main() {
vPos = position;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}`;
let fragmentShader = `
varying vec3 vPos;
uniform vec3 size;
uniform float thickness;
uniform float smoothness;
void main() {
float a = smoothstep(thickness, thickness + smoothness, length(abs(vPos.xy) - size.xy));
a *= smoothstep(thickness, thickness + smoothness, length(abs(vPos.yz) - size.yz));
a *= smoothstep(thickness, thickness + smoothness, length(abs(vPos.xz) - size.xz));
vec3 c = mix(vec3(0,0,0), vec3(1,1,1), a);
gl_FragColor = vec4(c, 1.0);
}`;Editor is loading...