Vijay Kumar Posted July 5, 2016 Share Posted July 5, 2016 Hi Deltakosh, can we skip the mesh not to be rendered when camera is not able to see that mesh. http://www.babylonjs-playground.com/#UJEZ1#8 in below screenshot camera is able to see two meshes so active indices count is 3912. in below screenshot sphere is behind the ground mesh so any how it is required to render the sphere, so can we skip that object from being rendered, so that active indices count also will be reduced. i have seen LOD concept but it is not helpful for my situation. The reason why i am asking this is, in my scene the objects in other room also getting rendered when camera is at that direction actually those are behind the wall . because of that my active indices count is very high and my scene performance is very slow. sorry for my poor English, but at least i think you guys understand what i am trying to explain. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted July 5, 2016 Share Posted July 5, 2016 @Vijay Kumar I think there were a post about this a while back, and if i don't recall completely wrong, it isn't posible before webgl 2.0. i don't quite remember what the correct term for it was though i suppose something you could do is to apply some kind of area triggers, example: all meshes that can't be seen from the starting point(either due to walls or distance, etc) are set to isVisible = false; by default. when a player then starts moving around, and is between this and that x and this and that z the meshes he is moving towards gets set to isVisible = true; while the meshes he is moving away from is set to isVisible = false; if that makes any sense Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 5, 2016 Share Posted July 5, 2016 Hello! we do not support occlusions queries as this will come with WebGL 2.0 In the meantime, as aWeirdo mentioned, you have to do it manually Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted July 6, 2016 Share Posted July 6, 2016 Made a quick AreaTrigger example So, basicly.. var player; player.area1shown = true; //starting area. player.area2shown = false; player.area3shown = false; var timeout= false; //registerBeforeRender.. if( player.position.x > -25 && player.position.x < -20 && player.position.z > 2 && player.position.z < 5 && !timeout){ timeout = true; //only run one time while the player is standing in the trigger field. if( player.area1shown ){ //area1 (starting area) is already visible so player is mostlikely leaving. player.area1shown = false; //call function to set meshes in starting area to isVisible = false; } else { player.area1shown = true; //call function to set meshes in starting area to isVisible = true; } } else { //when player leaves the areatrigger, allow it to be triggered again.. timeout= false; } Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted July 6, 2016 Author Share Posted July 6, 2016 Hi aWeirdo , Thanks for your suggestion and the valuable time you spent for me. the above concept will work when the camera is moving in straight path. For example in the below screenshot if the camera is in 1st position i can at least disable some meshes in 1st room, but if the camera is in 2nd position i think it is not possible to disable meshes in any room .. Is there any method like that the mesh is visible or not visible to camera in current frame. Quote Link to comment Share on other sites More sharing options...
Kesshi Posted July 6, 2016 Share Posted July 6, 2016 I don't know how this is done in games nowadays but older games like Doom or Quake used BSP trees to decide which part of the level is visible. Quote Link to comment Share on other sites More sharing options...
adam Posted July 6, 2016 Share Posted July 6, 2016 11 hours ago, Vijay Kumar said: but if the camera is in 2nd position i think it is not possible to disable meshes in any room You know what room you are in, and I'm assuming you know what objects are in each room. Just render the objects that are in your current room and the objects in any adjacent room if you are facing the doorway. Quote Link to comment Share on other sites More sharing options...
adam Posted July 6, 2016 Share Posted July 6, 2016 12 hours ago, Vijay Kumar said: Is there any method like that the mesh is visible or not visible to camera in current frame. Quote Link to comment Share on other sites More sharing options...
adam Posted July 6, 2016 Share Posted July 6, 2016 http://www.babylonjs-playground.com/#1J96H2#0 Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted July 7, 2016 Author Share Posted July 7, 2016 Hi adam, Thanks for the solutions provided by you. Frustum technique is a good concept but in my case this is not that much useful as i want avoid the meshes which are behind the other objects. Quote Link to comment Share on other sites More sharing options...
adam Posted July 7, 2016 Share Posted July 7, 2016 @Vijay Kumar I thought that would be useful if you want to know if you are facing a doorway. Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted July 8, 2016 Author Share Posted July 8, 2016 Ok Thanks Adam, now i understand your thought. 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.