BlackMojito Posted November 21, 2017 Share Posted November 21, 2017 Just as the screenshot shows, I have SSAO on the skybox too. How I can remove this? How can I disable depth writing when rendering the box? Thanks a lot Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 21, 2017 Share Posted November 21, 2017 Hello, as the SSAO is a postprocess you can rely on a 2 cameras approach: https://github.com/BabylonJS/Website/blob/master/Demos/DefaultRenderingPipeline/default.js (you can see that the first camera is used to render the scene with postprocess and the second one is used for the GUI) In your case the first camera could be just for the skybox and the second one for the actual scene Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted November 22, 2017 Author Share Posted November 22, 2017 11 hours ago, Deltakosh said: Hello, as the SSAO is a postprocess you can rely on a 2 cameras approach: https://github.com/BabylonJS/Website/blob/master/Demos/DefaultRenderingPipeline/default.js (you can see that the first camera is used to render the scene with postprocess and the second one is used for the GUI) In your case the first camera could be just for the skybox and the second one for the actual scene Thanks, Deltakosh. Hum...but how I can sync those two cameras though? BTW, I am thinking that maybe I can just use an environment sphere which can avoid the AO problem. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 23, 2017 Share Posted November 23, 2017 HI @BlackMojito Here's an example of a two camera approach, Imagine camera_A is your main camera with postprocess, camera_A has layerMask 2, so should any mesh you want it to render, e.g. the building in your screenshot, or the sphere in this example. camera_B is your secondary camera with no postprocess, camera_B has layermask 1, so does the ground mesh in this example. So camera_A is rendering the sphere. and camera_B is rendering the ground. Using ArcRotateCamera's, In a registerBeforeRender, we are updating camera_B's alpha, beta, radius and target values to match camera_A's values. (user input modifies camera_A). Take good note on the activeCameras.push, the first camera to be pushed will render behind the second camera. scene.activeCameras.push(camera_B, camera_A); http://playground.babylonjs.com/#QGW698 Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted December 5, 2017 Author Share Posted December 5, 2017 On 11/23/2017 at 3:25 PM, aWeirdo said: HI @BlackMojito Here's an example of a two camera approach, Imagine camera_A is your main camera with postprocess, camera_A has layerMask 2, so should any mesh you want it to render, e.g. the building in your screenshot, or the sphere in this example. camera_B is your secondary camera with no postprocess, camera_B has layermask 1, so does the ground mesh in this example. So camera_A is rendering the sphere. and camera_B is rendering the ground. Using ArcRotateCamera's, In a registerBeforeRender, we are updating camera_B's alpha, beta, radius and target values to match camera_A's values. (user input modifies camera_A). Take good note on the activeCameras.push, the first camera to be pushed will render behind the second camera. scene.activeCameras.push(camera_B, camera_A); http://playground.babylonjs.com/#QGW698 How can I keep the depth buffer between those cameras? It seems that secondary camera clears the depth buffer rendered with the first camera though... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 5, 2017 Share Posted December 5, 2017 No problem: scene.autoClearDepthAndStencil = false Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 5, 2017 Share Posted December 5, 2017 Hi again @BlackMojito & @Deltakosh I believe this and these topics; have the same goal; I think, what he means is that camera_A is always rendered behind camera_B, depth is "ignored" between cameras. Example; Only half the sphere in this PG should be visible; http://playground.babylonjs.com/#QGW698#4 Now, if you swap the cameras around and render camera_B before camera_A, rotating the cameras up or down will hide the sphere behind the box, again "ignoring" depth.http://playground.babylonjs.com/#QGW698#5 Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted December 6, 2017 Author Share Posted December 6, 2017 5 hours ago, aWeirdo said: Hi again @BlackMojito & @Deltakosh I believe this and these topics; have the same goal; I think, what he means is that camera_A is always rendered behind camera_B, depth is "ignored" between cameras. Example; Only half the sphere in this PG should be visible; http://playground.babylonjs.com/#QGW698#4 Now, if you swap the cameras around and render camera_B before camera_A, rotating the cameras up or down will hide the sphere behind the box, again "ignoring" depth.http://playground.babylonjs.com/#QGW698#5 yeah right, scene.autoClearDepthAndStencil = false cannot work for this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.