javascript - Three.js - apply shader to blur a geometry -


been learning threejs on past day or i'm struggling shaders.

i'm trying blur geometry have. tried using depth of field examples found on three.js site made foreground objects blurry too. i'm hoping single out 1 object , blur that.

now have mesh created lambertmaterial so:

    var material = new three.meshlambertmaterial({         color: 0x5c5c5c,         emissive: 0x000000,         shading: three.flatshading,         transparent: true,         opacity: 1     });     var mesh = new three.mesh(geometryjson, material);      scene.add(mesh); 

and found 2 shaders online (one verticle blur , 1 horizontal blur). how apply them while keeping above settings color ect?

horizontal blur shader

verticle blur shader

i tried using shadermaterial this:

    var material = new three.shadermaterial( {         uniforms: three.uniformsutils.clone( horizontalblurshader.uniforms ),         vertexshader: horizontalblurshader.vertexshader,         fragmentshader: horizontalblurshader.fragmentshader     } ); 

and works (now exported model uvs) - not expected.

my model renders semi-transparent depending on angle of face rather bluring it. how can make shader blur object, correct color original material , use verticle shader same time?

there no "easy" way blur single object in webgl know of off top of head. blur example , depth of field example in three.js post processing effects. means work after image has been rendered. loading image photoshop , applying filter entire image.

that doesn't mean blurring single object impossible. it's not going easy.

for example, render whether or not blur separate channel, alpha channel, change blur shader blurred pixels alpha channel set. won't perfect because 2 objects overlap, blurring bleed past overlapping blocked out when blur pass there won't info needed blur correctly. whether that's not acceptable aesthetic decision

another way render each object it's own render target, blur that, composite render targets. might need each render target store depth values can composite them depth.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -