JCPalmer Posted April 30, 2015 Share Posted April 30, 2015 Tower of Babel is a Blender exporter that generates Typescript / Javascript source code. This is an alternative to converting the contents of a .blend into data that needs to be loaded by JSON & constructed into Meshes / Cameras / Lights. This has the following implications:Inline source code loads very fast.Permits object oriented programming through subclassing.Source code is better handled in a repository than a .babylon.TOB 2.0 is now a top level directory of the Extensions repository https://github.com/BabylonJS/Extensions/tree/master/TowerOfBabel. This has taken a while actually making into the public repository. Being in the same repository as Dialog, it was held back till that was committed. The major new feature is taking advantage of the changes to cloning in BJS 2.0. This allowed subclasses of BABYLON.Mesh to also be cloned. This permitted a mesh factory concept, where you just ask for an instance of a mesh, using the same name as it was in Blender. var factory = new BlenderFileModule.MeshFactory(scene);var instance1 = factory.instance("blenderMeshName");var clone1 = factory.instance("blenderMeshName");var clone2 = factory.instance("blenderMeshName");The factory returns one, possibly a clone, if you have already asked for it before. This is turned on using a new checkbox shown when performing the export.If you have multiple mesh factories you can request your meshes also specifying the module name as parameter. (Include the very small TOB-runtime.js ). Here is how Font modules are initialized / called in Dialog:public static loadStockTypefaces(scene : BABYLON.Scene){ if (typeof (Font3D) !== 'undefined'){ TOWER_OF_BABEL.MeshFactory.MODULES.push(new Font3D.MeshFactory(scene)); Label.DEFAULT_FONT_MODULE = 'Font3D'; BABYLON.Tools.Log('Font3D loaded'); } if (typeof (Font2D) !== 'undefined'){ TOWER_OF_BABEL.MeshFactory.MODULES.push(new Font2D.MeshFactory(scene)); Label.DEFAULT_FONT_MODULE = 'Font2D'; BABYLON.Tools.Log('Font2D loaded'); } // see if an extensions is found if (typeof (Font3D_EXT) !== 'undefined'){ TOWER_OF_BABEL.MeshFactory.MODULES.push(new Font3D_EXT.MeshFactory(scene)); BABYLON.Tools.Log('Font3D_EXT loaded'); } if (typeof (Font2D_EXT) !== 'undefined'){ TOWER_OF_BABEL.MeshFactory.MODULES.push(new Font2D_EXT.MeshFactory(scene)); BABYLON.Tools.Log('Font2D_EXT loaded'); }}...var letter_g = TOWER_OF_BABEL.MeshFactory.instance("Font2D", "g");Each Blender un-parented mesh is generated as a subclass. Another new feature is being able to specify a base class to inherit from other than the BABYLON.Mesh default. What is great about this is you can use Blender to design & maintain your geometry, while seamlessly generating JS or TS source as a subclass of your own writing. (Sooner or later it has to inherit from BABYLON.Mesh, of course). This is specified in the custom data properties:With source code generated, you simply get an instance: (meshes in a .blend are generated as a module with name matching exported file)var myMesh = new BlenderFileModule.BlenderMesh(scene); RaananW, jerome and HeadClot 2 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted April 30, 2015 Share Posted April 30, 2015 Wow, that's allot to take in. I'm revisiting our entire pipeline for future projects, and it appears that the release of BJS 2.0 and TOB 2.0 is perfect timing for us to take a diffrent approach to working with meshes. Thank you for all of your work. I can't believe how quicky this framework is evolving and advancing. I hope developers who might be questioning whether the BJS framework is where they should be working, can look at this and other recent developments and see the advantages of BJS and this community over other development platforms. Thanks again. GameMonetize and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 30, 2015 Share Posted April 30, 2015 Thanks a lot my friend for this again! Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 1, 2015 Author Share Posted May 1, 2015 Dbawel,I really would skip 2.0, and go with 2.1. That version is in Beta, whatever that means, is much faster with "free lunch optimizations":SIMD integration. I am just starting to work with the Morph extension in this regard too. Freezing the computing of the world matrix of meshes you know as the developer do not move / scale / rotate very often, or ever. 2.0 did checking to avoid the recompute, but the checking itself was acting as a tax, limiting scalability. disabling frustrum clipping for stuff the game developer knows will always be seen. disabling meshes completely that you do not want to be seen, but don't want to get rid of yet, now has nearly 0 overhead cpu. computeNormals, if you call it, is much faster.By free lunch, i mean, there is no cost to be absorbed. Earlier optimizations like mesh simplification lost detail. Octrees needed like over a hundred meshes, I think, before it paid for its overhead. This stuff just eliminates cpu cost either by special cpu instructions, developer knowledge, or have just been profiled & improved. Also saw today, that textures are reload, when they should be being shared by different meshes in 2.0. Jeff Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 1, 2015 Share Posted May 1, 2015 Hi Jeff, Those are huge improvements, and I haven't found the BJS beta of previous versions buggy - at least since I've been using. Thanks for the advisement, as I haven't looked at the features in 2.1 at all yet. Things are moving so quickly, it seems like we just moved into using 2.0. In reviewing the updates that you listed here, I expect a noticable increase in performance of the type of scenes we're building - which are mesh and texture heavy, and am eager to test if there is a recordable improvement. Thanks again for all of your contributions to this quickly evolving framework. Cheers, DB Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 3, 2015 Author Share Posted May 3, 2015 Well, I am starting to actually think about my game again. The textures specifically. My philosophy is not "Simple yet powerful", like BabylonJS. I am more "execution at any cost". This does not mean that I tolerate over complexity. I have a tendency to avoid that by writing programs that write programs (technically complex, but the final code is dead simple). This is effective at annihilating design time, fixed data, while being punishingly fast. Am sort of thinking out loud, but for TOB 2.1 I am considering in-lining textures directly into source code. There is a static function in babylon.texture.ts, called CreateFromBase64String. DK, what if the data arg was actually the contents of a compressed nature, a jpg or jpeg2? Does the data have to be expanded, which would kill this? Did not want to do a lot with Python trying to write base64, when it forced the expansion first. Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 15, 2017 Share Posted December 15, 2017 @JCPalmer is Tower of Babel moved or ...? Thx. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 16, 2017 Share Posted December 16, 2017 https://github.com/BabylonJS/Extensions/tree/master/QueuedInterpolation/Blender JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 18, 2017 Share Posted December 18, 2017 QueuedInterpolation... indeed. Thx! Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 18, 2017 Author Share Posted December 18, 2017 Yep, that's where it went. You can use ToB without the QI animation system. It writes Blender actions to BJS AnimationRanges, similar to the the JSON exporter. Also, it does not write Typescript modules since this was published, only Javascript modules. The minor differences in code generation made the python code more complicated than it needed to be. Instead it just writes a d.ts file of the couple of external entry points. Works just as well. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 18, 2017 Share Posted December 18, 2017 Hero @JCPalmer. Thank you. 1) afalcon interested in formatted big arrays of numbers in objects/modules. 2) Thank you for non-type-safeness. JavaScript module patterns vastly preferred. There are reasons for not wrapping everyone in safety blankets. 3) Animation Ranges... and QI Animation System... +Like! Deep-dive pending...(Feb) .babylon current. Docs look fantastic... +1. Found the QI animation... <jokes-removed/> Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 18, 2017 Author Share Posted December 18, 2017 Actually, not es6 modules, but what Typescript generates for pre-es6. Have thought about it, es6, but not yet. Soon ie11 is just going to have to pound salt. I have a site of all my test scenes, but was referencing cdn.babylon.com. Have not got around to testing for 3.1. I know I have a problem with how pre-compiling materials was changed, so some scenes do not work. This is not going to get done prior to my Kinect integration work for Blender. Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 18, 2017 Share Posted December 18, 2017 Lol, pound salt! +1 tomorrow.... All understandable. Can't wait to read details and try things. 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.