MackeyK24 Posted August 15, 2017 Share Posted August 15, 2017 Hello guys... Got another tough one form me, hopefully someone can help. I am making a component for the BabylonJS toolkit to support LODGroup... to automatically build LOD support for meshes. In unity, when setting up a LODGroup... the levels are specified in percent: The documentations says "The percentages in the LOD bars represent the fraction of the view frustum depth where that LOD level becomes active. But in Babylon we apparently use actual distance values to setup LOD... My question is how can I convert these percentage values to distance to mesh.addLODLevel ??? Yo @Deltakosh and @Sebavan or @Wingnut ... SOMEBODY Please chime in here Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 15, 2017 Share Posted August 15, 2017 Perhaps (camera.maxZ - camera.minZ) * percentage Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted August 15, 2017 Author Share Posted August 15, 2017 1 hour ago, Deltakosh said: Perhaps (camera.maxZ - camera.minZ) * percentage Thanks @Deltakosh for responding ... Unity does not seem to "Specify" a camera... just use these percentage values... Should I ALWAYS use the Babylon.MainCamera (activeCamera) to do these calculations on the client side (since I don't have a way of saying a specific LOD Group is associated with a certain camera)... And what is Camera minZ and maxZ... would these exists in Unity Camera (maybe called something else)... so I can calculate what the distance is on the unity side then serialize distance values for each LOD group ??? What do you think?// Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2017 Share Posted August 15, 2017 maxZ is the farthest a mesh will render before its culled, and minZ in the closest it will be. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted August 15, 2017 Author Share Posted August 15, 2017 5 minutes ago, Pryme8 said: maxZ is the farthest a mesh will render before its culled, and minZ in the closest it will be. So in in unity... That would be the Near and far clipping planes... Right??? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted August 15, 2017 Author Share Posted August 15, 2017 1 minute ago, MackeyK24 said: So in in unity... That would be the Near and far clipping planes... Right??? EDIT: Yep I guess so... thats what use in the Toolkit to setup a camera... Unity: lodBias = 2.0 So you think I can get distance for each LOD by: var distance = lodBias * ((farClip - nearClip) * percentage) BabylonUniversalCamera babylonCamera = new BabylonUniversalCamera { name = camera.name, id = GetID(camera.gameObject), fov = camera.fieldOfView * (float)Math.PI / 180, minZ = camera.nearClipPlane, maxZ = camera.farClipPlane, parentId = GetParentID(camera.transform), position = camera.transform.localPosition.ToFloat() }; Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2017 Share Posted August 15, 2017 correct, and just by looking at that math it should work! I did a terrain LOD that might help you with how I calculated the distances for it: Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted August 26, 2017 Author Share Posted August 26, 2017 Go Full LOD Support working from Unity Editor LOD Groups... Again works perfect...not one single line of code to configure or setup anything Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 28, 2017 Share Posted August 28, 2017 Should I keep asking about a doc? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted August 29, 2017 Author Share Posted August 29, 2017 11 hours ago, Deltakosh said: Should I keep asking about a doc? Yo @Deltakosh .. My Man Im working on it bro... I need to work out some stuff in the features sets... Here a few screen shots... But im still working on it: Main exporters: Toolkit Overview Pages: But its a coming along Pryme8 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 29, 2017 Share Posted August 29, 2017 You're DA MAN! 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.