beng128 Posted July 19, 2017 Share Posted July 19, 2017 Is it at all possible to create the bounding volumes (ie Box, Capsule, Sphere) for meshes, in blender? I can't find anything in the babylon exporter plugin. I was hope this would be a feature, as it would make the process more data driven. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 25, 2017 Share Posted July 25, 2017 Hi Beng. No answers yet, eh? I'm going to ping @JCPalmer and @gryff in case they want to ride-along. First, and for curious readers, What IS Bounding Volume Hierarchy (BVH)? Start here. Then maybe here. Generally speaking, it is somewhat similar to octrees in that it allows some "quick elimination" of large chunks of intersection/collision testing. A complex model could be divide into, for example... 5 different bounding areas, each containing many many subMeshes or children bounding-areas. For increased speed of intersection testing, we can quickly test WHICH of the "big 5 bounding areas" was hit by intersection. This eliminates up-to 80% of the intersection testing, because we know which 4/5ths of the entire complex model... WASN'T intersected. Now, perhaps that 1/5th that WAS hit... is divided into 5 equal sections. Test those 5, and perhaps we can eliminate 4/5ths of THOSE, as well. With just a few intersection tests, we have "narrowed-it-down-to" a rather precise area that got the intersection hit. BVH is certainly MUCH faster than iterating the entire submesh-list of the entire model, one-by-one. I don't know what support Blender has... for BVH, but it can be web-researched. I wonder if it CAN be exported, and what it looks-like when it IS exported. It is surely a tree-structure. A BVH tree-walker is likely not part of the current BJS framework, and I'm not sure it ever SHOULD be. But tree-walking is certainly a fairly common JS thing-to-do. (Careful, don't confuse THIS BVH, with a BVH format used for motion-capture data.) I suspect... it all starts with an experimental mod to our exporter, and learning how Blender structures its BVH, if it even has them, natively. It looks like it is part of the "Cycles" area, so, hmm... does that matter somehow? Let's pretend that a Blender BVH can be passed into the .babylon exporter, or perhaps, as part of an .obj export. Once it arrived at BJS, it is going to require special handling, and then a whole different way of testing for intersections. We won't be doing "standard" tree-walking... for intersections. We'll be adding intersect observers that have "priorities". Likely, we'll check the TOP BVH sections first, eliminate as many as possible. Then check the TOP of THAT/THOSE remaining "tree-limb(s)"... eliminate whatever can be eliminated, etc, etc. WHILE doing all of that, IS that cannonball that caused the first intersection observation... continuing it's high-speed flight into/through OTHER sections of the model... sections that MIGHT have been eliminated during the FIRST intersection processing? In other words, even though we eliminated some major subsections of the model during our first intersection tests, those eliminated "top sections" must still have active observers for MORE intersections as the cannonball travels THRU other sections of the model/BVH. They HAVE TO keep observers active, even though they were eliminated in the initial intersect check. Phew. I think it is a cool idea, and BJS is a great way to do cool experiments with it. I think it has a bright future, and might surpass octrees. Interesting. Anyway, this thread got onto page 3 of Q&A with 0-replies, so it needed bumping. I'm no expert in these systems... not even close. But I thought I'd rattle-on a little... what the heck. Hopefully, others will comment, soon. Cool subject. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 25, 2017 Share Posted July 25, 2017 Google of "Blender bounding volume" does not really get anything, only bounding box. If you can live with a box, BJS can display one that kept in the framework. I forgot how to turn it on. Even if it were in Blender, we are only setup to export the faces of a mesh, ignoring my particle hair experiments. Were it to be implemented, it would undoubtedly be vertices without faces. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 25, 2017 Share Posted July 25, 2017 JC - https://wiki.blender.org/index.php/Dev:Source/Render/Cycles/BVH They seem to be rather particular about the naming. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 25, 2017 Share Posted July 25, 2017 So the answer to your question is yes. A BVH can be created in Blender from python. What this has to do with BJS I do not know. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 25, 2017 Share Posted July 25, 2017 Well JC, JC! I already painted-out the scenario in my first post. If a user can set a flag on a Blender model (export BVH if available?)... then the BVH tree for that model could import-into BJS land. Then, the user can build their own intersection system that takes advantage of the potential speed increase. The usage for BJS is obvious, but not yet coded. User could do experiments after the tree arrived. I hope I'm not making you angry. You are not required to answer this user. The initial forum question is a little vague, but I think we can assume that Beng wants to know if a Blender-made BVH can be brought into BJS scope. (He mentioned the exporter.) *shrug* Perhaps Beng will give us more details. Quote Link to comment Share on other sites More sharing options...
gryff Posted July 26, 2017 Share Posted July 26, 2017 @Wingnut: Well Wingy my only knowledge of this kind of BVH in Blender is shown in the image below. They are used to improve render performance - and are different tor the two Blender internal render engines. A is the Blender Render Engine, and B is the Cycles Render Engine. It is my understanding for A that the BVH is calculated as needed. For B, again the BVH is calculated as needed but with the option to save the BVH to a cache. Note the two engines seem to use different algorithms. The file saved to the cache is not easily readable. So how you might export them - I hate to think. And then of course there is 3Dmax - there are a number of render engines for it (5+?) And I have no idea how they work. How you would develop compatibility across all these options? cheers, gryff Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 26, 2017 Share Posted July 26, 2017 Hey, thanks Gryff. Interesting info. Check-out this tutorial. Phew. Perhaps I understand Jeff's "What's that got to do with BJS" -thing a bit better. It almost looks more-targeted toward the folks at Khronos. I think I might be "in over my head", yet again, here. 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.