{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/6783","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/6783/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/6783/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/6783/events","html_url":"https://github.com/mrdoob/three.js/issues/6783","id":92842891,"number":6783,"title":"Render not getting properly cleared after using ImmediateRenderObject (depth buffer issue?)","user":{"login":"dmnsgn","id":1636460,"avatar_url":"https://avatars.githubusercontent.com/u/1636460?v=3","gravatar_id":"","url":"https://api.github.com/users/dmnsgn","html_url":"https://github.com/dmnsgn","followers_url":"https://api.github.com/users/dmnsgn/followers","following_url":"https://api.github.com/users/dmnsgn/following{/other_user}","gists_url":"https://api.github.com/users/dmnsgn/gists{/gist_id}","starred_url":"https://api.github.com/users/dmnsgn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmnsgn/subscriptions","organizations_url":"https://api.github.com/users/dmnsgn/orgs","repos_url":"https://api.github.com/users/dmnsgn/repos","events_url":"https://api.github.com/users/dmnsgn/events{/privacy}","received_events_url":"https://api.github.com/users/dmnsgn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mrdoob/three.js/labels/Bug","name":"Bug","color":"ffcfcf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-03T10:16:22Z","updated_at":"2015-07-08T22:48:33Z","closed_at":null,"body":"Mask a 3D scene with another 3D scene using EffectComposer seems to work fine with basic THREE objects but not with ImmediateRenderObject:\r\n\r\n- basic example using THREE.Mesh http://jsfiddle.net/at4rumn6/3/\r\n\r\n![maskmesh](https://cloud.githubusercontent.com/assets/1636460/8497271/c548f8a0-2173-11e5-8ff3-3a563ca015b6.jpg)\r\n\r\n- MarchingCube example using THREE.ImmediateRenderObject http://jsfiddle.net/Lwm93rxr/2/\r\n\r\n![maskimmediaterenderobject](https://cloud.githubusercontent.com/assets/1636460/8497281/d2bc03ce-2173-11e5-8776-b511a34ccca8.jpg)\r\n\r\nThe render loop is the following:\r\n```javascript\r\n// Render the scene with objects into the WebGLRenderTarget rtMain\r\nrenderer.render( sceneMain, camera, rtMain );\r\n\r\n// Render the mask scene into the WebGLRenderTarget rtMask\r\n// It contains a mesh with a material coloured red 0xff0000\r\nrenderer.render( sceneMask, camera, rtMask );\r\n\r\n// Render the composer which has a ShaderPass \r\n// mixing the two textures rtMain and rtMask passed as uniforms\r\n// gl_FragColor = mix( background, texelA, texelB.r )\r\ncomposer.render();\r\n```\r\n\r\nIt looks like something is not cleared after `renderer.render( sceneMain, camera, rtMain );`\r\n\r\nI am posting this question as an issue as it might be a limitation in the library.\r\n\r\nhttp://stackoverflow.com/questions/31192322/three-js-render-not-getting-cleared-after-using-immediaterenderobject\r\n\r\n---\r\n\r\nTHREE.WebGLRenderer 71, Chrome 43, Mac OS X Yosemite, NVIDIA GeForce GT 755M 1024 MB"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/119752690","html_url":"https://github.com/mrdoob/three.js/issues/6783#issuecomment-119752690","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/6783","id":119752690,"user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T22:48:33Z","updated_at":"2015-07-08T22:48:33Z","body":"@brunoimbrizi Ok, e48ab82edddf68fc2869440af8edcb33677ec5a5 fixes the new issue. I'll look at @dmnsgn original issue next."}}