A quick Shape Key Demo with JCPalmer's new Blender exporter (May 25th 2021)

Well @JCPalmer has posted his new version of the Blender exporter (for Blender 2.93) so I had to try it out.

It took awhile to download Blender 2.93 (Beta) and install. Then I got the new exporter and tried it out with a new vocal animation. Result :

Violetta

The vocal animation was done quickly and the audio created as well. It uses the same head that I have previously used and Jeff has posted on his github pages.

Just a little background on the music - it goes back about 65 years to my youth. I lived in a seaside tourist town with several theatres. One theatre had a comedian who did impressions of the singer, Joseph Locke, so I got to know his songs. The music used is a little snippet of a Joseph Locke song from the 1950s. He was very popular in the UK at the time, though he did run into trouble with his taxes! And they made a film about him with the US actor, Ned Beatty, playing him.

At a first quick glance, there seem to be a couple of issues with controlling the animation length, but maybe more experimenting and getting used to the shape key exporter will sort it out.

In the meantime, a big thanks to Jeff :slight_smile:

Stay Safe All, gryff :slight_smile:

4 Likes

With all the material work done for this release, I have found some problems exporting my own work right out of the gate.

Was planning on “going” to this WebXR online thing today. Got ticket, but the only thing you can seem to do with a ticket is cancel it, so that is what I did. Tickets to nowhere. @RaananW thing is recorded, so probably available later. That is the only I wanted in addition to: Is WC3 going to do a Multiview standard for webXR or not?

With my schedule open, immediately ran into issues. The last thing I did was change some low level stuff to get overloading of diffuse & emission fields to work. I mostly recovered right now, but probably not doing another push today. Ignore highly metallic materials for now.

haha this is always the case for me as well when I add features :slight_smile:

1 Like

Responding directly, rather than giving a status, I have added better logging for these type of animations. This is what the ‘To be, or not’ scene now logs: ( I have not pushed a new zip yet though)

processing begun of mesh:  Male_Head
    processing begun of material:  skin
        processing texture skin1
            texture type:  diffuseTexture, mapped using: "DiffMap"
    num positions      :  1478
    num normals        :  1478
    num tangents       :  0
    num uvs            :  2956
    num uvs2           :  0
    num colors         :  0
    num triangles      :  2482
    Shape Keys:
        head-open added
            adding action "KeyAction":  [1 - 124]
        head-wide added
            adding action "KeyAction":  [1 - 124]
        head-upper added
            adding action "KeyAction":  [1 - 124]

Thing to note is that whether it is open, wide, or upper, you might need a frame that is a consistent start. For optimization, if a given key does not change from the previous frame, it is skipped in the output, but the first frame for a key is always written. An AnimationGroup might handle animations with different starting frames, but I did not notice it in the docs.

If there is not a consistent last frame, each of the animations will not end at the same time. I do not know that is a problem for looping though, thinking that AnimationGroups should be handling that.

Think ahead, you are probably going to want to move teeth as well. You can keep the meshes separate, and just make keys on the teeth which make sense, probably skipping wide. You could assign the same action to the teeth mesh to test on Blender, but I definitely join the meshes for export. I do all my animation post export, but I do a whole bunch of joins to the body (teeth, tongue, eyes, eye browse, & eye lashes) prior to export, and keys of the same name get glued together.


On a content level, since you already have a Christmas scene which you could re-use parts of, you might give “White Christmas” a try. Bing is a little more well known, but the song is older & still far more well known. It is also 6 months away, so it would give you enough time to play.

Also, I do not know if you wish to do all your meshes yourself (including shapekeys), but I made a bunch of “expressions” in MakeHuman, which are really just sub-expressions. I used to publish them, but here is MOUTH-OPEN.mhpose.

{
    "license": "Apache 2.0", 
    "name": "MOUTH-OPEN", 
    "copyright": "(c) Jeff Palmer, 2017", 
    "tags": [
        "QI.Automaton"
    ], 
    "author": "Jeff Palmer", 
    "unit_poses": {
        "JawDropStretched": 0.225, 
        "JawDrop": 1.0
    }, 
    "homepage": "https://github.com/Palmer-JC/"
}

And, MOUTH-WIDE.mhpose

{
    "license": "Apache 2.0", 
    "name": "MOUTH-WIDE", 
    "copyright": "(c) Jeff Palmer, 2017", 
    "tags": [
        "QI.Automaton"
    ], 
    "author": "Jeff Palmer", 
    "unit_poses": {
        "MouthRightPullSide": 1.0, 
        "MouthLeftPullSide" : 1.0
    }, 
    "homepage": "https://github.com/Palmer-JC/"
}

And MOUTH-LIPS_UPPER_UP.mhpose

{
    "license": "Apache 2.0", 
    "name": "MOUTH-LIPS_UPPER_UP", 
    "copyright": "(c) Jeff Palmer, 2017", 
    "tags": [
        "QI.Automaton"
    ], 
    "author": "Jeff Palmer", 
    "unit_poses": {
        "UpperLipUp": 1.0, 
        "UpperLipForward": 0.5, 
        "UpperLipStretched": 0.5
    }, 
    "homepage": "https://github.com/Palmer-JC/"
}

More less I pass all of them through all the way to BJS. You can see all of them in action on this old scene, just click the Expression Dev checkbox & move the sliders. I also support negative values, mirrored around an axis, which neither Blender nor BJS support, but if there are any others you are interested in, list them.

You just take these .mhpose files & put them in a MakeHuman directory, then from the MakeHuman Blender Plug-in drag them across directly into shapekeys on each mesh. Kind of turns the “art” of having perfect meshes with identically consistent shapekeys into just pushing buttons, but gives you a lot more time to make your art beyond that.

If interested, I’ll add more details.

@JCPalmer : I will look into using the make human poses. TY Jeff :slight_smile:

In the meantime I’m having a little problem with the new exporter with other issues.

This is a walking the path demo that I posted recently:

Exported from Blender 2.90 with Exporter version 6.4.4

Path Walk 1

Exported from Blender 2.93 with Exporter version 2.93-beta 1

Path Walk 2

Same file loaded into both versions of Blender, and the two index files are the same apart from the .babylon file that they load.

Issue 1 : the materials. For example the “blue shirt” in 2.90:

{“name”:“blue”,“id”:“blue”,“customType”:“BABYLON.StandardMaterial”,“backFaceCulling”:true,“checkReadyOnlyOnce”:false,“maxSimultaneousLights”:4,“diffuse”:[0.0063,0.0326,0.8],“specular”:[0.2273,0.2273,0.2273],“specularPower”:34.9091,“alpha”:1,“indexOfRefraction”:0.6897},

But from 2.93 :

{“name”:“blue”,“id”:“blue”,“customType”:“BABYLON.StandardMaterial”,“specularPower”:102.4,“alpha”:1},

No mention of a diffuse or specular color.

Edit: Both Materials exported as “Standard” materials.

Issue 2 : even though the scripts are the same the character does not rotate to face the direction he is moving. Somehow it has broken my script?

I’m not sure what you make of all that ?

Stay Safe Jeff, gryff :slight_smile:

As far as materials missing things, I just pushed Beta 2. Your materials should be the same, though checkOnlyOnce was gotten rid of. Other things which have the same value as the BJS default are no longer written, like maxSimulataneousLights in your example.

For the walk, please post both .log files as a starting point.

@JCPalmer : I will get the Beta 2 version and create new files. Post the logs tomorrow.

Stay Safe Jeff, gryff :slight_smile:

1 Like

@JCPalmer : OK downloaded the Beta 2 version and exported my file from 2.90 and 2.93 again. The log files look the same, so I have included both the babylon files too. Seem to be differences at the end of the babylon files with how “cameras” are being handled - just “activeCameraID:Camera” not “cameras”:,“activeCameraID”:“Camera”, and no line ““morphTargetManagers”:”.

Given you have been making adjustments about what to include, those differences may, or may not be important. And differences with animation definitions too.

The materials seem to be ok now.

The files

If you need anything else, just let me know Jeff.

Stay Safe, gryff :slight_smile:

Ok, the reason for this lack of rotation is I have removed billboardmode from the export when it was the same as the default, none.

That is why a lot of other stuff is gone too. BJS never changes defaults, so it is just more irrelevant stuff to look at. Taking the if statement off the conditional writing of the billboardmode property only requires holding down the delete key for a little, so it is not a big deal, but any idea why @Deltakosh ?

All this came about because I wanted the source code generator variant to write more intelligent / readable source by eliminating meaningless code which did not have to be written. That variant goes even further by not even writing position, rotation & scale, when they are (0, 0, 0) , (1, 1, 1), or (1, 1, 1) respectively.

1 Like

Can you elaborate on the issue you’re seeing?

Basically, gryff is rotating an imported mesh in a beforerenderer, but it always faces forward. He provided 2 exports. I screen scraped the html, which was nearly identical, & ran everything locally. When I put back writing billboardmode whether it was the default or not, it fixed it.

You can see his 2 scenes from links up. Thinking about it more, there must not be a test in the parse to see if it is in the file, so load sets it to null or something. Even if something on this side was changed, that would only be for BJS 5.0, which is not out yet. Blender 2.93 is going production any day, so just going to always write.

You are correct. if there is NO property defined the system will default to undefined and should not set the value. But this is not what happening here? IF you do not export the property it will set the billboard mode to on?

It seems so. After cloning the 2 html files, & seeing that locally produced the same result, I changed the line for the boots / shoes in my side-by-side diff editor (Netbeans) which put the billboard mode entry back. Now the boots rotate without the body.

There was other stuff put back, shown on to screen shots

To be absolutely sure it was not one of the other properties, I manually did it to the suit, and now 2 of the 3 now rotate.

What is actually rotating / moving is an empty parent mesh, but do not think it should matter.

@JCPalmer and @Deltakosh : I added a few lines of code to my script :

aCube.billboardMode = BABYLON.Mesh.BILLBOARDMODE_NONE;
var clothes = aCube.getChildren();
console.log(clothes.length);
for(i=0; i<clothes.length; i++){
clothes[i].billboardMode = BABYLON.Mesh.BILLBOARDMODE_NONE;
}

And it is now working locally

More to come.

Stay Safe, gryff :slight_smile:

Ok I understand now: if not defined it will be set to undefined:
Babylon.js/mesh.ts at master · BabylonJS/Babylon.js (github.com)

This will generate issues in the renderer for sure so yes I recommend to always output it

1 Like

Update after a long github wait!!

Blender 2.93 export with added “billboardMode” code

Makes me wonder about "changes and consequences … "

Stay Safe All, gryff :slight_smile:

1 Like

I have deleted the test whether to write that field, and always do it. published a beta 3. Probably going to have a life time of a day or 2.

1 Like

@JCPalmer and @Deltakosh : Downloaded Beta 3 and re-exported my file. Works fine - no need for additional code above any more :slight_smile:

Will see how things progress, although I do notice that I am not getting :

“cameras”:,“activeCameraID”:“Camera”,

Still just the :

{“name”:“Empty”,“id”:“Empty”,“position”:[0,0,0],“rotation”:[0,0,0],“scaling”:[1,1,1],“isVisible”:false,“isEnabled”:true}],“activeCameraID”:“Camera”,

But no problems, so …

Stay Safe Jeff and David :slight_smile:

Ok, I have eliminated writing an activeCameraID, when there are no cameras being exported, but there is a camera in the scene named Camera. Is that camera in a disabled collection?

Either way, neither version exports a camera. All top level collections (materials, multiMaterials, skeletons, meshes, morphTargetManagers, animationGroups, cameras, lights, shadowGenerators, & sounds) must have at least one entry to be included in the file.