shadow casted by mesh with skeleton not proper

Recommended Posts

ok let me give you more context on the initial bug fix.

The bone used by  @satguru was incorrect because the bones were not completely influencing the mesh (ie the sum of matrices weight was not 1 but something like 0.98)

So I fixed it with a check while loading files: if the sum is not 1 then I fix the latest weight:

But seems like it was not such a good idea :)

Share this post

Link to post
Share on other sites

Can you  make sure you are using the very latest 3.1? (published one hour ago)

And to make sure my code is the source of this issue can you also run your code after having ran this line:

BABYLON.Geometry.prototype._CleanMatricesWeights = function() {}

Share this post

Link to post
Share on other sites

Sorry Dk, but it's always the same.

I tried the line you also : BABYLON.Geometry.prototype._CleanMatricesWeights = function () {}

said and empty the cache.

And use last version 3.1 :  <script src="<?php echo time();?>"></script>

I made a PG here :


Share this post

Link to post
Share on other sites

My PG example works with http. At home it works PG. You can use http.I have no virus on my link

I do not understand well. My character is perfectly made, the mesh is 100% influenced by the bones (Model buy to a professional, realized with 3ds max). I use it for 5 years without ever any problem, even with Babylon. This always works well. And now not work.

I suppose there is another problem. I use 3ds max, and satguru, blender. So anyone who uses 3ds max, will have their model animate like this? The previous version of Babylon works. Why more now?

Try without https

This always works for me and now that a problem is settled for satguru, this does not work for me anymore. It's my model that has a bug that has still worked well for years.

version 3.0 on PG work (screen left) , but not version 3.1(screen right) :

598a039f95904_2017-08-0820_31_22-Greenshot.jpg.eae45d010b29d09e1c45a42051f38ebc.jpg 598a044545e52_2017-08-0820_34_08-Greenshot.jpg.cf935027bca0f041e6538665f6f6e49a.jpg


Share this post

Link to post
Share on other sites

@Deltakosh, @Dad72, and @satguru

Well here is Vincent again using the latest preview version of BJS ( which I have renamed to "babylon.3.1-alpha1.js" to avoid overwriting my previous version which I know worked fine)

New Vincent

I also checked the .log file for vertex influencers (bones I assume)

Avg # of influencers per vertex:  1.1592
Highest # of influencers observed:  2, num vertices with this:  776
exported as 2 influencers

Nothing extraordinary there.

cheers, gryff :)

Share this post

Link to post
Share on other sites

Ok this was because of Chrome. Firefox was not forcing https.

Anyway, I fixed your issue as well.

By default the skin loading remains unchanged to preserve backward compatibility

@satguru: I added a new static for you: BABYLON.SceneLoader.CleanBoneMatrixWeights = true

Share this post

Link to post
Share on other sites

@Deltakosh, Yes that worked to an extent.

But still not there.

When I use 

"BABYLON.SceneLoader.CleanBoneMatrixWeights = true"

The uv texture  is messed up.

See bad_texture.jpg 

Without the line I get good_texture.jpg

Also the the specular color is now set to white.

As a result meshes end up being very shiny.

Previously it used to be black.



Share this post

Link to post
Share on other sites

This is not a magical tool unfortunately. The data is broken at the source. You need to clean up your model because I will not be able to provide better automatic support

The code for the cleaner is here so you can understand what it tries to do:


Regarding shininess this is not related to the bones issues. There must be a difference in the file as specular was not changed recently. What are the value of your specular setup?

Share this post

Link to post
Share on other sites


Ok . I will revisit my source and also checkout the code you pointed out.

Regarding specular you are right,  it is not a bone issue.

Previously when I loaded mesh they would have a specular color of #000000. Now they have #ffffff.


Share this post

Link to post
Share on other sites

I have this annoying bug with skeleton meshes too!
The model not changed, since about april, but the shadows are kind of "inverse" now.
The shadow is correctly animated (moving) but inverse.
The shadows were working before.

If I set skeleton=null, the shadows are correct.
Tried to re-export from Blender with 5.4 export, but stays the same.
tried setting BABYLON.SceneLoader.CleanBoneMatrixWeights = true but the mesh was distorted.
The meshes are imported with  loader.addMeshTask(... 

-images with and without skeleton.
-zip of .babylon file

How can I "clean" the mesh source?
I think this is not the problem of the model, this model worked before.



Share this post

Link to post
Share on other sites

The playground is in text.
I re-exported this vincent now from blender, with 5.4 exporter.
And started an animation and it is not right at all.
So, something is wrong with this vincent model or the exporter.

But... how it is possible thet the same model, (my goblin) was working with shadows with previous babylon js versions?
Something did change that make it impossible to export the modelfrom blender and importing it to babylon with animations and shadows.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.