Jump to content

Tower of Babel released


JCPalmer
 Share

Recommended Posts

Tower of Babel is now in GitHub.  To summarize, it is a rewrite of the first Babylon exporter for Blender.  In addition to internal modularization, its main improvements are:

  • It produces a .babylon, (.js & .ts inline code modules), and a log file.
  • It extracts & optimizes Shape Keys in groups, based on their name.  Changes to use this coming later.
  • Camera rotation & light position animation has been added.
  • Camera LockedTarget is now transferred from Blender.

It should be noted that all output formats (.babylon, .js, & .ts) are independent of each other.  Decide on the one you wish to use and  delete / ignore the others.

 

The .babylon Is roughly 8 to 11 % smaller than the old one.  This is achieved by reducing the size of numbers like -0.0000 to 0.

 

The log file records the process performed, as well as displays up to 12 warning messages.  Should the python script error, the stack trace describing the problem will also be contained in the log file.

 

The .js is a standalone source file.  You would reference it with a script tag just as you would babylon.js.  To load the entire scene, add this to your .html:

blender_file_name.initScene(scene);

 

Meshes without a parent are implemented as sub-classes of either Babylon.Mesh or Babylon.Automaton.  If you wish to load them separately like SceneLoader. importMesh does, you would instance them.

var inst = new blender_file_name.meshName(scene);

 

The .ts would be added into your code base, to converted to a .js as part of your build process.

 

The sub-classes may also be sub-classed themselves coming from either the .js or .ts.  How varies based on which file. 

 

It should be noted that the sharing of vertices or "Babylon Instances" IS NOT supported for .js or .ts, due to the way "Babylon Instances" is currently implemented.

 

gryff has supplied many blend files for testing.  I have grouped them along with the outputs, & multiple versions of .html files to load them into a directory structure.  It was meant to be placed in GitHub, so future changes can be easily tested to avoid regressions.

 

For now I have included them as a .zip.  I am very far from a Git expert, so I will leave it to others to know whether to put it in as separate files or 1 .zip.  I have more for Automaton that I have left out right now.

 

Please test this with your .blend files.

 

Thanks,

 

Jeff

blender-test.zip

Link to comment
Share on other sites

Tower of Babel is now in GitHub.

 

I saw that on github while browsing to see what updates there maybe - said it was added 2 hours ago.

 

Fascinating Jeff. Great to see your progress. Will spend time looking at what is in the zip file and how it is used.

 

gryff has supplied many blend files for testing

 

I think "many" might be a little bit of an overstatement. :blink:

 

EDIT: Jeff, what Blender version did you work with - 2.69?

 

cheers, gryff :)

Link to comment
Share on other sites

gryff,

Yes, 2.69.  BTW, both the Blender and the TOB versions used at run time are the first line of the log file.  I am not aware that the version of Blender that the .blend was save in is actually accessible.  But if it could be found in the python API, it should also be listed in line 1.

 

In the blender-test zip file, there is a blender-in directory for all the .blend files.  I changed the names of the blend files to reflect the main thing being tested.  Could probably use a read me to describe more than can be put in a file name, also with the directions written here.

 

There is also a lib directory to hold the babylon.js.  This probably should not be populated in Github.  Also, probably made a mistake by not changing the name of the .js.  It should probably be "babylon.js".  This way all the .html's in the root directory, never need to ever be edited as time goes on.

 

The TOB-out directory holds the .babylon, .js, .ts, & .log of every .blend exported.  It is in a separate directory so that every thing can easily be deleted.  This ensures that you are not actually running with stuff exported previously.  It has the stuff I generated, but it to should probably be saved in Github empty.

 

Finally, the root dir of the zip, has a xxx_JSON.html & xxx_inline.html for each .blend.  Again, they are probably not perfect yet.  They should be changed to load "./lib/babylon.js" not "./lib/babylon.1.13-beta.js". 

 

Have fun!

 

Jeff

Link to comment
Share on other sites

Yes, 2.69  ....  I am not aware that the version of Blender that the .blend was save in is actually accessible.

 

Nothing to worry about Jeff. I have 16 different versions of Blender installed on my computer - all the way back to 2.49. And before you ask, it is because some addon scripts, that  I have used, break in more advanced versions of Blender. For example the script I used to create the "lipsync" demo only works in Blender 2.60/2.61, and some scripts I have used to create meshes for Second Life only work in early 2.5x versions of  Blender.

 

A big change in Blender came with the 2.63 version with the introduction of Ngons (faces with more than 4 vertices). Open a .blend file created in Blender 2.66, in the 2.61 version - you get no faces. It can be worked around - but is a pain.

 

The reason I asked - is so that I am on the same page as you. But of course I can also test your export script on a number of different Blender versions :)

 

cheers, gryff :)

Link to comment
Share on other sites

Thanks,

I am in the process of switching from Netbeans to Eclipse, which HAS to be better at Typescript.  It also has a github helper plug-in in addition to git support.  I need all the help I can get in this area  (This is different from CSV).  I am not using Netbeans projects for this, just editing files, so I can not rely on it to commit directories, and move them upstream.

 

For now here is another zip for gryff, with changes above made & readme added.  Hopefully, I'll be able to do actual Babylon builds & move up changes to the repository with ease after the conversion.

 

Here is the contents of the readme.md:

 

This directory is for regression testing of the Tower of Babel.  It is assumed that the add-in has already been installed & enabled in Blender.

Place the version of babylon.js you wish to use in the 'lib' directory.  The earliest supported is 1.13.  All of the html files reference it as 'babylon.js' to avoid having to edit them.  FYI, the htmls write a message into the browser console, listing the version, in-case you forget.

The 'blender-in' directory holds each of the .blend files.  The name reflects the main thing being tested.  Refer to the table below, for a more complete list of features being tested.

The 'TOB-out' directory is where you should direct the .babylon/.js/.ts/.log output from Blender.  This directory is isolated, so that everything can easily be deleted.  This ensures that you are not actually running with stuff exported previously.  This directory is empty in Github, so each .html will not run unless, you open Blender with the respective .blend & export to this directory.

Speaking of htmls,  the this directory has a xxx_JSON.html & xxx_inline.html for each .blend.

Here is the list of tests & secondary features they test:

.blend       secondary features
------------ ------------------------------------------------------------------------------
armature     skeletal animation
automaton   Camera LockedTarget, Automaton's embedded Action Manager, Single ShapeKeyGroup
camera_anim  Multi-materials, textures
mesh_parent  Shadows

 

 

blender-test.zip

Link to comment
Share on other sites

Jeff, the readme.md mentions:

 

automaton    Camera LockedTarget, Automaton's embedded Action Manager, Single ShapeKeyGroup

I don't see anything else about "automaton" in the new zip files.

 

cheers, gryff :)

Link to comment
Share on other sites

Yes, I am still working on that one, mostly the html part that does the animation.  Also it generates code for Babylon.Automaton & Babylon.ShapeKeyGroup, which is just going to blow up till it is released,  I pulled it from the zip, just like the first one.  Also I just noticed that shadows are not working.  That is why TOB is version 0.99

Link to comment
Share on other sites

I am now on Eclipse, mostly.  My hand converted Automaton .js files to .ts files have some problems, as well as the .ts files generated out of the exporter.  At least I can now see the problems, but that is not what this current message is about.

 

I wanted to push up what was the zip file of this topic.  As said before, certain directories should not be populated in GitHub, lib & TOB-out.  I have edited .gitignore with this:

# files inside parts of blender-test directory structureExporters/Blender/blender-test/lib/babylon.js # not *.* incase doing a sub-class testExporters/Blender/blender-test/TOB-out/*.*

The problem is that then there are no files to commit, and Eclipse does not give an empty directory to commit, so it can be pushed.  Any suggestions.  I tried removing the entry for lib, & deleted babylon.js, but still nothing shows up to commit / push.

Link to comment
Share on other sites

Gryff,

On the mesh that I did, mesh_parent.blend, I cannot get shadows to work in either the old exporter, or TOB(.babylon & .js).  I achecked that the shadow generator is being populated with a render list of 'Gus', and the ground is set to receive shadows.

 

I have put the light in extreme positions.  Where it is now, I get this dark triangle in the middle of the ground, but it is not even on the correct side of Gus.

 

Think it my Blender skills that are in question, since all three produce the exact same result.  Could you look / fix this model, such that it gives a shadow, at least with old exporter?  Just steal the html from zip file.

 

Jeff

mesh_parent.blend.txt

Link to comment
Share on other sites

I have put the light in extreme positions.  Where it is now, I get this dark triangle in the middle of the ground

 

Jeff, will look at the file and see what I can do. I have a feeling though it might have to do with BJS lighting in general and not the BJS version. (Something I think I have run into before -"the dark triangle")

 

More later as I have a couple of issues with a couple of clients that need to be resolved

.

cheers, gryff :)

Link to comment
Share on other sites

I don't think it is your Blender skills Jeff - it seems to be an issue with the Directional light functionality.

 

Example 1 - Gingerbred man with a directional light in front and close to him:

 

Shadow1

 

Result: black area on ground.

 

Example 2 - Gingerbred man with directional light in front and far away :

 

Shadow2

 

Result: No black area on ground

 

Example 3 - A row of blocks with a directional light in front and close to them:

 

Shadow3

 

Result:  the same black area on the ground - but also note not all the shadows of the blocks and the shadows are angled.

 

To me it looks like an issue with the Directional light functionality of BJS.

 

cheers, gryff :)

Link to comment
Share on other sites

Jeff, here is a pic showing the way the Directional Light works in the Unity game engine. Note that even though the light is positioned in the center of the scene, the cylinder,  which you might think of as behind that light, is illuminated. In Unity the position of the light does not matter - only the direction (rotation)  of the light.

 

In BJS it looks like an area behind the light is not illuminated

 

cheers, gryff :)

post-7026-0-53511000-1406649062.jpg

Link to comment
Share on other sites

Ok, thanks. I'll just leave what I got for now, since it is a valid test.  Moving this stuff up in the near future, along with some TOB fixes (mostly in the .ts output area, & ability to specify a directory for texture file location). 

 

I finally got back to shape keys in the last day or so.  Fully typescript converted now & finishing directly in typescript.  Working on movement & rotation coordinated with deformation , for things like: walking, stair climbing, flying.   I wrote it yesterday using Actions, called directly using action.execute().  I am not happy with it, though I never actually ran it.  Not so much with the actions, but things need to be so specific in terms of position coordinates, that they are both difficult to know, and worthless to re-use.

 

Mulling the concept of 'forward', and a method in Automaton like moveForward(relativeVec3).  Would need to capture any changes to rotation, to maintain knowing where forward is (override computeWorldMatrix() probably).  If this works, then is no reason this concept cannot be implemented back at the BABYLON.Mesh class, instead of BABYLON.Automaton.

Link to comment
Share on other sites

light position is used to compute the shadow map so everything behind the light is in the dark (And sounds like this is logical no?)

 

This is logical if we consider some kind of "spot light" or "area light", but very often in 3D modelers and game engines (for instance Unity 3D, also Quest3D if I remember well), "directionnal light" is considered as "the sun". That means you can only put one in your scene, and, as gryff said, anywhere you position it the engine always considers it as an "infinite distance light", far away from the scene, only the direction is then used to compute lightning and shadowing (and not its position, nor any kind of distance attenuation).

Link to comment
Share on other sites

BTW, JCPalmer, these days you're constantly talking about "BABYLON.Automaton"...

 

But I find this nowhere !

I search the whole Babylon project (up to date from Github, 5 minutes ago) and no occurence of automaton at all...

 

What is this mysterious object, where can I find it, where can I find info about it ?

Argl please my curiosity can't stand it any longer :lol:

Link to comment
Share on other sites

BTW, JCPalmer, these days you're constantly talking about "BABYLON.Automaton"...

 

But I find this nowhere !

I search the whole Babylon project (up to date from Github, 5 minutes ago) and no occurence of automaton at all...

 

What is this mysterious object, where can I find it, where can I find info about it ?

Argl please my curiosity can't stand it any longer :lol:

 

I have not yet put in my pull request, as you probably figured out.  I am not built for many releases & this project is not merely animation transferred from Blender.  Only shape-keys end states are.  You produce the animation through an API on the JS side.  It has been changing as I have been testing it out and seeing how it needs to be improved.

 

Am not really thrilled about making either non-compatible changes or living with mistakes.  I want to have the API set.  I have code to compute the normals which is not working, and other things never tested, but will make API my top priority, so I can put out something.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...