Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
922 views
in Technique[技术] by (71.8m points)

glsl - Blur a Instanced Mesh in Three.js

I want to blur the material color of my instanced meshes. The left side is the original design, it's looks like a blurred shadow and on the right side you see my current situation. The problem is that I don't know how to blur an instanced mesh. I tried different things in my vertex and fragment shader, but it didn't work. Does anybody know how to fix this without post-processing?

enter image description here

This is my vertex

varying vec3 vNormal;
attribute vec4 color;
varying vec4 vColor;
varying float intensity;

void main() {
  vec3 vNormal = vec3(instanceMatrix * vec4(normal, 0.0));
  vec4 mvPosition = instanceMatrix * vec4( position, 1.0 );
  vec4 modelViewPosition = modelViewMatrix * mvPosition;
  intensity = pow(0.2 - dot(normalize(cameraPosition), vNormal), 4.0);
  gl_Position = projectionMatrix * modelViewPosition;
  vColor = color;
}

This is my fragment

varying float intensity;

void main() {
  vec3 glow = vec3(0.0, 0.0, 0.0);
  gl_FragColor = vec4(glow, 1.0);
}
question from:https://stackoverflow.com/questions/65893213/blur-a-instanced-mesh-in-three-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...