OutlinePass.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. /**
  2. * @author spidersharma / http://eduperiment.com/
  3. */
  4. THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
  5. this.renderScene = scene;
  6. this.renderCamera = camera;
  7. this.selectedObjects = selectedObjects !== undefined ? selectedObjects : [];
  8. this.visibleEdgeColor = new THREE.Color(1, 1, 1);
  9. this.hiddenEdgeColor = new THREE.Color(0.1, 0.04, 0.02);
  10. this.edgeGlow = 0.0;
  11. this.usePatternTexture = false;
  12. this.edgeThickness = 1.0;
  13. this.edgeStrength = 3.0;
  14. this.downSampleRatio = 2;
  15. this.pulsePeriod = 0;
  16. THREE.Pass.call( this );
  17. this.resolution = ( resolution !== undefined ) ? new THREE.Vector2(resolution.x, resolution.y) : new THREE.Vector2(256, 256);
  18. var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
  19. var resx = Math.round(this.resolution.x/this.downSampleRatio);
  20. var resy = Math.round(this.resolution.y/this.downSampleRatio);
  21. this.maskBufferMaterial = new THREE.MeshBasicMaterial({color:0xffffff});
  22. this.maskBufferMaterial.side = THREE.DoubleSide;
  23. this.renderTargetMaskBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
  24. this.renderTargetMaskBuffer.texture.generateMipmaps = false;
  25. this.depthMaterial = new THREE.MeshDepthMaterial();
  26. this.depthMaterial.side = THREE.DoubleSide;
  27. this.depthMaterial.depthPacking = THREE.RGBADepthPacking;
  28. this.depthMaterial.blending = THREE.NoBlending;
  29. this.prepareMaskMaterial = this.getPrepareMaskMaterial();
  30. this.prepareMaskMaterial.side = THREE.DoubleSide;
  31. this.renderTargetDepthBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
  32. this.renderTargetDepthBuffer.texture.generateMipmaps = false;
  33. this.renderTargetMaskDownSampleBuffer = new THREE.WebGLRenderTarget( resx, resy, pars );
  34. this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = false;
  35. this.renderTargetBlurBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
  36. this.renderTargetBlurBuffer1.texture.generateMipmaps = false;
  37. this.renderTargetBlurBuffer2 = new THREE.WebGLRenderTarget( Math.round(resx/2), Math.round(resy/2), pars );
  38. this.renderTargetBlurBuffer2.texture.generateMipmaps = false;
  39. this.edgeDetectionMaterial = this.getEdgeDetectionMaterial();
  40. this.renderTargetEdgeBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
  41. this.renderTargetEdgeBuffer1.texture.generateMipmaps = false;
  42. this.renderTargetEdgeBuffer2 = new THREE.WebGLRenderTarget( Math.round(resx/2), Math.round(resy/2), pars );
  43. this.renderTargetEdgeBuffer2.texture.generateMipmaps = false;
  44. var MAX_EDGE_THICKNESS = 4;
  45. var MAX_EDGE_GLOW = 4;
  46. this.separableBlurMaterial1 = this.getSeperableBlurMaterial(MAX_EDGE_THICKNESS);
  47. this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2(resx, resy);
  48. this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = 1;
  49. this.separableBlurMaterial2 = this.getSeperableBlurMaterial(MAX_EDGE_GLOW);
  50. this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2(Math.round(resx/2), Math.round(resy/2));
  51. this.separableBlurMaterial2.uniforms[ "kernelRadius" ].value = MAX_EDGE_GLOW;
  52. // Overlay material
  53. this.overlayMaterial = this.getOverlayMaterial();
  54. // copy material
  55. if ( THREE.CopyShader === undefined )
  56. console.error( "THREE.OutlinePass relies on THREE.CopyShader" );
  57. var copyShader = THREE.CopyShader;
  58. this.copyUniforms = THREE.UniformsUtils.clone( copyShader.uniforms );
  59. this.copyUniforms[ "opacity" ].value = 1.0;
  60. this.materialCopy = new THREE.ShaderMaterial( {
  61. uniforms: this.copyUniforms,
  62. vertexShader: copyShader.vertexShader,
  63. fragmentShader: copyShader.fragmentShader,
  64. blending: THREE.NoBlending,
  65. depthTest: false,
  66. depthWrite: false,
  67. transparent: true
  68. } );
  69. this.enabled = true;
  70. this.needsSwap = false;
  71. this.oldClearColor = new THREE.Color();
  72. this.oldClearAlpha = 1;
  73. this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
  74. this.scene = new THREE.Scene();
  75. this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
  76. this.scene.add( this.quad );
  77. this.tempPulseColor1 = new THREE.Color();
  78. this.tempPulseColor2 = new THREE.Color();
  79. this.textureMatrix = new THREE.Matrix4();
  80. };
  81. THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
  82. constructor: THREE.OutlinePass,
  83. dispose: function() {
  84. this.renderTargetMaskBuffer.dispose();
  85. this.renderTargetDepthBuffer.dispose();
  86. this.renderTargetMaskDownSampleBuffer.dispose();
  87. this.renderTargetBlurBuffer1.dispose();
  88. this.renderTargetBlurBuffer2.dispose();
  89. this.renderTargetEdgeBuffer1.dispose();
  90. this.renderTargetEdgeBuffer2.dispose();
  91. },
  92. setSize: function ( width, height ) {
  93. this.renderTargetMaskBuffer.setSize(width, height );
  94. var resx = Math.round(width/this.downSampleRatio);
  95. var resy = Math.round(height/this.downSampleRatio);
  96. this.renderTargetMaskDownSampleBuffer.setSize(resx, resy );
  97. this.renderTargetBlurBuffer1.setSize(resx, resy );
  98. this.renderTargetEdgeBuffer1.setSize(resx, resy );
  99. this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2(resx, resy);
  100. resx = Math.round(resx/2);
  101. resy = Math.round(resy/2);
  102. this.renderTargetBlurBuffer2.setSize(resx, resy );
  103. this.renderTargetEdgeBuffer2.setSize(resx, resy );
  104. this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2(resx, resy);
  105. },
  106. changeVisibilityOfSelectedObjects: function( bVisible ) {
  107. var gatherSelectedMeshesCallBack = function( object ) {
  108. if( object instanceof THREE.Mesh ) {
  109. object.visible = bVisible;
  110. }
  111. };
  112. for( var i=0; i<this.selectedObjects.length; i++ ) {
  113. var selectedObject = this.selectedObjects[i];
  114. selectedObject.traverse( gatherSelectedMeshesCallBack );
  115. }
  116. },
  117. changeVisibilityOfNonSelectedObjects: function( bVisible ) {
  118. var selectedMeshes = [];
  119. var gatherSelectedMeshesCallBack = function( object ) {
  120. if( object instanceof THREE.Mesh ) {
  121. selectedMeshes.push(object);
  122. }
  123. };
  124. for( var i=0; i<this.selectedObjects.length; i++ ) {
  125. var selectedObject = this.selectedObjects[i];
  126. selectedObject.traverse( gatherSelectedMeshesCallBack );
  127. }
  128. var VisibilityChangeCallBack = function( object ) {
  129. if( object instanceof THREE.Mesh ) {
  130. var bFound = false;
  131. for( var i=0; i<selectedMeshes.length; i++ ) {
  132. var selectedObjectId = selectedMeshes[i].id;
  133. if(selectedObjectId === object.id) {
  134. bFound = true;
  135. break;
  136. }
  137. }
  138. if(!bFound) {
  139. var visibility = object.visible;
  140. if( !bVisible || object.bVisible )
  141. object.visible = bVisible;
  142. object.bVisible = visibility;
  143. }
  144. }
  145. };
  146. this.renderScene.traverse( VisibilityChangeCallBack );
  147. },
  148. updateTextureMatrix: function() {
  149. this.textureMatrix.set( 0.5, 0.0, 0.0, 0.5,
  150. 0.0, 0.5, 0.0, 0.5,
  151. 0.0, 0.0, 0.5, 0.5,
  152. 0.0, 0.0, 0.0, 1.0 );
  153. this.textureMatrix.multiply( this.renderCamera.projectionMatrix );
  154. this.textureMatrix.multiply( this.renderCamera.matrixWorldInverse );
  155. },
  156. render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
  157. if(this.selectedObjects.length === 0 )
  158. return;
  159. this.oldClearColor.copy( renderer.getClearColor() );
  160. this.oldClearAlpha = renderer.getClearAlpha();
  161. var oldAutoClear = renderer.autoClear;
  162. renderer.autoClear = false;
  163. if ( maskActive ) renderer.context.disable( renderer.context.STENCIL_TEST );
  164. renderer.setClearColor( 0xffffff, 1 );
  165. // Make selected objects invisible
  166. this.changeVisibilityOfSelectedObjects(false);
  167. // 1. Draw Non Selected objects in the depth buffer
  168. this.renderScene.overrideMaterial = this.depthMaterial;
  169. renderer.render( this.renderScene, this.renderCamera, this.renderTargetDepthBuffer, true );
  170. // Make selected objects visible
  171. this.changeVisibilityOfSelectedObjects(true);
  172. // Update Texture Matrix for Depth compare
  173. this.updateTextureMatrix();
  174. // Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects
  175. this.changeVisibilityOfNonSelectedObjects(false);
  176. this.renderScene.overrideMaterial = this.prepareMaskMaterial;
  177. this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new THREE.Vector2(this.renderCamera.near, this.renderCamera.far);
  178. this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture;
  179. this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix;
  180. renderer.render( this.renderScene, this.renderCamera, this.renderTargetMaskBuffer, true );
  181. this.renderScene.overrideMaterial = null;
  182. this.changeVisibilityOfNonSelectedObjects(true);
  183. // 2. Downsample to Half resolution
  184. this.quad.material = this.materialCopy;
  185. this.copyUniforms[ "tDiffuse" ].value = this.renderTargetMaskBuffer.texture;
  186. renderer.render( this.scene, this.camera, this.renderTargetMaskDownSampleBuffer, true );
  187. this.tempPulseColor1.copy( this.visibleEdgeColor );
  188. this.tempPulseColor2.copy( this.hiddenEdgeColor );
  189. if( this.pulsePeriod > 0 ) {
  190. var scalar = ( 1 + 0.25 ) / 2 + Math.cos( performance.now() * 0.01/ this.pulsePeriod ) * ( 1.0 - 0.25 )/2;
  191. this.tempPulseColor1.multiplyScalar( scalar );
  192. this.tempPulseColor2.multiplyScalar( scalar );
  193. }
  194. // 3. Apply Edge Detection Pass
  195. this.quad.material = this.edgeDetectionMaterial;
  196. this.edgeDetectionMaterial.uniforms[ "maskTexture" ].value = this.renderTargetMaskDownSampleBuffer.texture;
  197. this.edgeDetectionMaterial.uniforms[ "texSize" ].value = new THREE.Vector2(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height);
  198. this.edgeDetectionMaterial.uniforms[ "visibleEdgeColor" ].value = this.tempPulseColor1;
  199. this.edgeDetectionMaterial.uniforms[ "hiddenEdgeColor" ].value = this.tempPulseColor2;
  200. renderer.render( this.scene, this.camera, this.renderTargetEdgeBuffer1, true );
  201. // 4. Apply Blur on Half res
  202. this.quad.material = this.separableBlurMaterial1;
  203. this.separableBlurMaterial1.uniforms[ "colorTexture" ].value = this.renderTargetEdgeBuffer1.texture;
  204. this.separableBlurMaterial1.uniforms[ "direction" ].value = THREE.OutlinePass.BlurDirectionX;
  205. this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = this.edgeThickness;
  206. renderer.render( this.scene, this.camera, this.renderTargetBlurBuffer1, true );
  207. this.separableBlurMaterial1.uniforms[ "colorTexture" ].value = this.renderTargetBlurBuffer1.texture;
  208. this.separableBlurMaterial1.uniforms[ "direction" ].value = THREE.OutlinePass.BlurDirectionY;
  209. renderer.render( this.scene, this.camera, this.renderTargetEdgeBuffer1, true );
  210. // Apply Blur on quarter res
  211. this.quad.material = this.separableBlurMaterial2;
  212. this.separableBlurMaterial2.uniforms[ "colorTexture" ].value = this.renderTargetEdgeBuffer1.texture;
  213. this.separableBlurMaterial2.uniforms[ "direction" ].value = THREE.OutlinePass.BlurDirectionX;
  214. renderer.render( this.scene, this.camera, this.renderTargetBlurBuffer2, true );
  215. this.separableBlurMaterial2.uniforms[ "colorTexture" ].value = this.renderTargetBlurBuffer2.texture;
  216. this.separableBlurMaterial2.uniforms[ "direction" ].value = THREE.OutlinePass.BlurDirectionY;
  217. renderer.render( this.scene, this.camera, this.renderTargetEdgeBuffer2, true );
  218. // Blend it additively over the input texture
  219. this.quad.material = this.overlayMaterial;
  220. this.overlayMaterial.uniforms[ "maskTexture" ].value = this.renderTargetMaskBuffer.texture;
  221. this.overlayMaterial.uniforms[ "edgeTexture1" ].value = this.renderTargetEdgeBuffer1.texture;
  222. this.overlayMaterial.uniforms[ "edgeTexture2" ].value = this.renderTargetEdgeBuffer2.texture;
  223. this.overlayMaterial.uniforms[ "patternTexture" ].value = this.patternTexture;
  224. this.overlayMaterial.uniforms[ "edgeStrength" ].value = this.edgeStrength;
  225. this.overlayMaterial.uniforms[ "edgeGlow" ].value = this.edgeGlow;
  226. this.overlayMaterial.uniforms[ "usePatternTexture" ].value = this.usePatternTexture;
  227. if ( maskActive ) renderer.context.enable( renderer.context.STENCIL_TEST );
  228. renderer.render( this.scene, this.camera, readBuffer, false );
  229. renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
  230. renderer.autoClear = oldAutoClear;
  231. },
  232. getPrepareMaskMaterial: function() {
  233. return new THREE.ShaderMaterial( {
  234. uniforms: {
  235. "depthTexture": { value: null },
  236. "cameraNearFar": { value: new THREE.Vector2( 0.5, 0.5 ) },
  237. "textureMatrix" : { value: new THREE.Matrix4() }
  238. },
  239. vertexShader:
  240. "varying vec2 vUv;\
  241. varying vec4 projTexCoord;\
  242. varying vec4 vPosition;\
  243. uniform mat4 textureMatrix;\
  244. void main() {\
  245. vUv = uv;\
  246. vPosition = modelViewMatrix * vec4( position, 1.0 );\
  247. vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\
  248. projTexCoord = textureMatrix * worldPosition;\
  249. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\
  250. }",
  251. fragmentShader:
  252. "#include <packing>\
  253. varying vec2 vUv;\
  254. varying vec4 vPosition;\
  255. varying vec4 projTexCoord;\
  256. uniform sampler2D depthTexture;\
  257. uniform vec2 cameraNearFar;\
  258. \
  259. void main() {\
  260. float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\
  261. float viewZ = -perspectiveDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );\
  262. float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\
  263. gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\
  264. }"
  265. } );
  266. },
  267. getEdgeDetectionMaterial: function() {
  268. return new THREE.ShaderMaterial( {
  269. uniforms: {
  270. "maskTexture": { value: null },
  271. "texSize": { value: new THREE.Vector2( 0.5, 0.5 ) },
  272. "visibleEdgeColor": { value: new THREE.Vector3( 1.0, 1.0, 1.0 ) },
  273. "hiddenEdgeColor": { value: new THREE.Vector3( 1.0, 1.0, 1.0 ) }
  274. },
  275. vertexShader:
  276. "varying vec2 vUv;\n\
  277. void main() {\n\
  278. vUv = uv;\n\
  279. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\
  280. }",
  281. fragmentShader:
  282. "varying vec2 vUv;\
  283. uniform sampler2D maskTexture;\
  284. uniform vec2 texSize;\
  285. uniform vec3 visibleEdgeColor;\
  286. uniform vec3 hiddenEdgeColor;\
  287. \
  288. void main() {\n\
  289. vec2 invSize = 1.0 / texSize;\
  290. vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\
  291. vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\
  292. vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\
  293. vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\
  294. vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\
  295. float diff1 = (c1.r - c2.r)*0.5;\
  296. float diff2 = (c3.r - c4.r)*0.5;\
  297. float d = length( vec2(diff1, diff2) );\
  298. float a1 = min(c1.g, c2.g);\
  299. float a2 = min(c3.g, c4.g);\
  300. float visibilityFactor = min(a1, a2);\
  301. vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\
  302. gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\
  303. }"
  304. } );
  305. },
  306. getSeperableBlurMaterial: function(maxRadius) {
  307. return new THREE.ShaderMaterial( {
  308. defines: {
  309. "MAX_RADIUS" : maxRadius
  310. },
  311. uniforms: {
  312. "colorTexture": { value: null },
  313. "texSize": { value: new THREE.Vector2( 0.5, 0.5 ) },
  314. "direction": { value: new THREE.Vector2( 0.5, 0.5 ) },
  315. "kernelRadius": { value: 1.0 }
  316. },
  317. vertexShader:
  318. "varying vec2 vUv;\n\
  319. void main() {\n\
  320. vUv = uv;\n\
  321. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\
  322. }",
  323. fragmentShader:
  324. "#include <common>\
  325. varying vec2 vUv;\
  326. uniform sampler2D colorTexture;\
  327. uniform vec2 texSize;\
  328. uniform vec2 direction;\
  329. uniform float kernelRadius;\
  330. \
  331. float gaussianPdf(in float x, in float sigma) {\
  332. return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\
  333. }\
  334. void main() {\
  335. vec2 invSize = 1.0 / texSize;\
  336. float weightSum = gaussianPdf(0.0, kernelRadius);\
  337. vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\
  338. vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\
  339. vec2 uvOffset = delta;\
  340. for( int i = 1; i <= MAX_RADIUS; i ++ ) {\
  341. float w = gaussianPdf(uvOffset.x, kernelRadius);\
  342. vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\
  343. vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\
  344. diffuseSum += ((sample1 + sample2) * w);\
  345. weightSum += (2.0 * w);\
  346. uvOffset += delta;\
  347. }\
  348. gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\
  349. }"
  350. } );
  351. },
  352. getOverlayMaterial: function() {
  353. return new THREE.ShaderMaterial( {
  354. uniforms: {
  355. "maskTexture": { value: null },
  356. "edgeTexture1": { value: null },
  357. "edgeTexture2": { value: null },
  358. "patternTexture": { value: null },
  359. "edgeStrength" : { value: 1.0 },
  360. "edgeGlow" : { value: 1.0 },
  361. "usePatternTexture" : { value: 0.0 }
  362. },
  363. vertexShader:
  364. "varying vec2 vUv;\n\
  365. void main() {\n\
  366. vUv = uv;\n\
  367. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\
  368. }",
  369. fragmentShader:
  370. "varying vec2 vUv;\
  371. uniform sampler2D maskTexture;\
  372. uniform sampler2D edgeTexture1;\
  373. uniform sampler2D edgeTexture2;\
  374. uniform sampler2D patternTexture;\
  375. uniform float edgeStrength;\
  376. uniform float edgeGlow;\
  377. uniform bool usePatternTexture;\
  378. \
  379. void main() {\
  380. vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\
  381. vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\
  382. vec4 maskColor = texture2D(maskTexture, vUv);\
  383. vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\
  384. float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\
  385. vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\
  386. vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\
  387. if(usePatternTexture)\
  388. finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\
  389. gl_FragColor = finalColor;\
  390. }",
  391. blending: THREE.AdditiveBlending,
  392. depthTest: false,
  393. depthWrite: false,
  394. transparent: true
  395. } );
  396. }
  397. } );
  398. THREE.OutlinePass.BlurDirectionX = new THREE.Vector2( 1.0, 0.0 );
  399. THREE.OutlinePass.BlurDirectionY = new THREE.Vector2( 0.0, 1.0 );