reddozen Posted January 23, 2015 Share Posted January 23, 2015 Is there an existing way to do this without looping through every object in the scene and doing additional expensive distance calculations? If not, could a new variable be added to mesh for "max view range", default 0 (unlimited), and with the same distance check loop that the LOD engine goes through, set these meshes to visible / invisible based on this range if not 0? Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 23, 2015 Share Posted January 23, 2015 camera has minZ and maxZ variables to limit the view range.Defaults are 1 (min) and 1000 (max) . is that what you mean? Quote Link to comment Share on other sites More sharing options...
reddozen Posted January 23, 2015 Author Share Posted January 23, 2015 I'm talking about at the mesh level sadly. Similar to how LOD models will hide the parent and unhide the LOD model, but I want max view range on the mesh to hide everything about the mesh while out of range. Quote Link to comment Share on other sites More sharing options...
amorgan Posted January 23, 2015 Share Posted January 23, 2015 The LOD systems allows you to do this by calling:var viewDistance = 100;mesh.addLODLevel(viewDistance, null); Quote Link to comment Share on other sites More sharing options...
reddozen Posted January 23, 2015 Author Share Posted January 23, 2015 The LOD systems allows you to do this by calling:var viewDistance = 100;mesh.addLODLevel(viewDistance, null); Interesting, but how can this be incorporated with the auto LOD? For example:I have my parent part that assign my auto LOD to.I have a couple instances that i need varying view ranges on for scene optimizations.I cannot set a generalized null distance on the parent to feed down to the instances because it's situational. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 23, 2015 Share Posted January 23, 2015 The automatic LOD is not designed for it (not yet). It would add another parameter to hide the object along a certain distance. for exemple: add: show: false => hide meshenewMeshes[0].simplify([{distance:250, quality:0, show: false}]) //Default show: true.What do you think Raanan ? Quote Link to comment Share on other sites More sharing options...
reddozen Posted January 23, 2015 Author Share Posted January 23, 2015 This wouldn't fix my specific situation though dad72. Have to remember that I'm loking for a solution at the mesh level. Be that a parent, clone, instance, whatever. LODs are assigned at the parent level, so my max view range setting would then be only at the parent level. This new variable would be in there with the position xyz, rotation xyz, and scale xyz variables assigned to every mesh.mesh.maxRange = 100; Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 23, 2015 Share Posted January 23, 2015 (edited) I haven't tested this nice suggestion of amorgan, but I think adding it to the parent mesh with a specific distance will cause all others to behave the same, as the LODs used are the same.So setting a null at distance 200 will make all instances disappear if the camera is 200 units away from them.Again, haven't tested, but should work :-)Seems like it is working. making it variable is another thing (200 for one mesh, 300 for another) - http://www.babylonjs-playground.com/#2JBSNA#1 Edited January 23, 2015 by RaananW amorgan 1 Quote Link to comment Share on other sites More sharing options...
reddozen Posted January 23, 2015 Author Share Posted January 23, 2015 I think you're right RaananW. It won't work for me though. Quote Link to comment Share on other sites More sharing options...
Venerated1 Posted March 17, 2017 Share Posted March 17, 2017 This was good to know, but it turns out that my skybox was the only reason I couldn't see things far away... so I made it bigger. 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.