<p dir="auto">The <a href="http://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture" rel="nofollow">WEBGL_depth_texture extension</a> is widely supported, at least on desktop implementations of WebGL.</p>
<p dir="auto">It would be nice to be able to use depth textures in three.js; render to depth and stencil buffers, as well as using depth textures as input.<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alteredq/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/alteredq">@alteredq</a> mentioned in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2362890" data-permission-text="Title is private" data-url="https://github.com/mrdoob/three.js/issues/806" data-hovercard-type="issue" data-hovercard-url="/mrdoob/three.js/issues/806/hovercard" href="https://github.com/mrdoob/three.js/issues/806">#806</a> that he ran into some limitations when playing with depth textures, so I figured it deserves its own issue.</p>
<p dir="auto">An alternative to supporting depth textures could be to be able to supply our own framebuffers as render target, but I suspect the refactoring necessary to do this might be the largest hurdle anyway.</p>
<p dir="auto">Hey guys, wrestled with this for days but need some help.<br>
( THREE.js R69, Windows8, NVIDIA GeForce GTX 760, Chrome 39.0.2171.71 m )</p>
<p dir="auto">This JSFiddle <a href="http://jsfiddle.net/Angrypickle/mbtdxazy/24/" rel="nofollow">http://jsfiddle.net/Angrypickle/mbtdxazy/24/</a> shows a LensFlare image appear in front of the PerspectiveCamera as the camera moves away (and is looking away) from the actual lensflare position. You may have to re-run the jsfiddle to see it appear because it happens quickly.</p>
<p dir="auto">The lensflare should only appear at position [0,0,0] but when the camera reaches a certain distance, a duplicate lensflare appears in a location opposite the original lensflare. The distance necessary to achieve the bug seems to be related to the camera's <code class="notranslate">.near</code> and <code class="notranslate">.far</code> properties.</p>
<p dir="auto">I can circumvent the bug by setting a higher <code class="notranslate">camera.near</code> value, but I don't want to do that :) Thanks in advance for help!</p>