title: How to use alpha map textures with ShaderMaterial in Three.js?
body: <p>I have a png image (16x16) that I want to use as an alpha map texture, in a custom material <code>THREE.ShaderMaterial</code>. This is the image:</p>
  
  <p><a href="https://i.stack.imgur.com/KvuUI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KvuUI.png" alt="Alpha Map"></a></p>
  
  <p>This is the setup for my preloaded Texture object:</p>
  
  <pre><code>alphaMap.magFilter = THREE.NearestFilter
  alphaMap.wrapT = THREE.RepeatWrapping
  alphaMap.repeat.y = 10
  alphaMap.needsUpdate = true
  </code></pre>
  
  <p>In the properties of the ShaderMaterial I added:</p>
  
  <pre><code>transparent: true
  </code></pre>
  
  <p>Then added <code>defines</code>:</p>
  
  <pre><code>USE_ALPHAMAP: true,
  ALPHATEST: 0.5
  </code></pre>
  
  <p>And finally the <code>uniform</code>:</p>
  
  <pre><code>alphaMap: { type: 't', value: alphaMap }
  </code></pre>
  
  <p>I don't get any errors but the mesh is not visible. If i set it as <code>diffuseColor.rgb</code> the mesh is all black. What is missing or wrong?</p>