Last active
          July 5, 2016 13:27 
        
      - 
      
 - 
        
Save henrytriplette/17626e5a8a9d3301e1455639839f376d to your computer and use it in GitHub Desktop.  
    Three.js - Remove White Border on Alpha Renderer/AntiAliasing 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* -------------------------------------------------- */ | |
| // With Three.js transparent backgound enabled (alpha)// | |
| // and model white textures on dark background // | |
| // sometimes artifacts pop up on the edges. // | |
| // To avoid that, slightly raise the clearcolor // | |
| // opacity instead of disabilng antialias. // | |
| /* -------------------------------------------------- */ | |
| // Standard Renderer | |
| renderer = new THREE.WebGLRenderer( { | |
| antialias: true, | |
| alpha: true | |
| }); | |
| // renderer.setClearColor(0x000000, 0); | |
| renderer.setClearColor(0xFFFFFF, 0.5); // YAY! | |
| // DPR calculation | |
| var maxDPR = 2 // usually between 2 - 3 | |
| var dpr = Math.min(maxDPR, window.devicePixelRatio); | |
| renderer.setPixelRatio(dpr); | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment