Advertisement
Guest User

sof

a guest
Nov 4th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. I'm implementing OutlinePass on my project, with EffectComposer, FXAAShader, CopyShader and ShaderPass included. I've followed the steps in the example, yet these 2 errors appeared and the whole scene was pitch black. I have no idea how to fix them since they all pointed to the included OutlinePass library. Any one has any idea of how to fix these? Thanks a lot!
  2.  
  3. Errors:
  4.  
  5. > Uncaught TypeError: Cannot read property 'prototype' of undefined
  6. at OutlinePass.js:131
  7. > Uncaught TypeError: this.getPrepareMaskMaterial is not a function
  8. at new THREE.OutlinePass (OutlinePass.js:45)
  9. at init (script.js:89)
  10. at script.js:219
  11.  
  12. Here is the code:
  13.  
  14. var OUTLINE;
  15. var COMPOSER;
  16. var FXAA;
  17.  
  18. function init() {
  19. scene.add(controls.getObject());
  20.  
  21. COMPOSER = new THREE.EffectComposer(renderer);
  22.  
  23. var renderPass = new THREE.RenderPass(scene, camera);
  24. COMPOSER.addPass(renderPass);
  25.  
  26. FXAA = new THREE.ShaderPass(THREE.FXAAShader);
  27. FXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight);
  28. FXAA.renderToScreen = true;
  29. COMPOSER.addPass(FXAA);
  30.  
  31. OUTLINE = new THREE.OutlinePass(new THREE.Vector2(window.innerWidth, window.innerHeight), scene, camera);
  32. OUTLINE.edgeStrength = 6;
  33. OUTLINE.edgeGlow = 1;
  34. OUTLINE.edgeThickness = 4;
  35. OUTLINE.pulsePeriod = 2;
  36. OUTLINE.visibleEdgeColor = 0xffff00;
  37. OUTLINE.hiddenEdgeColor = 0xffffff;
  38. COMPOSER.addPass(OUTLINE);
  39. }
  40.  
  41. function animate() {
  42. requestAnimationFrame(animate);
  43. COMPOSER.render();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement