Jump to content

Blender Animations inverting mesh normals


amorgan
 Share

Recommended Posts

The above two examples are done with babylon.2.0-beta.js (downloaded last Saturday - Jan 24th 2015 - from github)

 

This is the same babylon file used in the above two examples but using babylon.1.14.js

 

3. Animation Playing

 

It seems to work fine

 

I am not sure if this is a Bablyon issue or a Blender issue

 

Well amorgan, to me there seem to be two options:

 

a.) There is an issue with the exporter - which seems unlikely as the file behaves the way it should with babylon v1.14.

 

b.) There is an issue with babylon 2 .

 

Be nice if a babylon coder took a look at this thread. :unsure:

 

cheers, gryff :)

Link to comment
Share on other sites

I am also having a problem with bone animation.  The test .blend Gryff made suddenly went weird once animation started.  I thought it was me doing something in exporter.  I have been getting frequent updates to 2.0.  Think it started last Thursday.

 

Did not report, because I thought it was me, but this does seem to fit with an external (to me) change.

Link to comment
Share on other sites

Found another on Jan 22, 632.6 kb, a little smaller than the Jan 23 file.  Still have the problem.

 

Using Github, got the file with the tag '/*! Babylon 2015-01-20 */'.  Still the error.  I have not been re-running my entire battery of test with every version I get.  Do not actually care much about bones, since I have not actually been do dev there.

 

Was going to check earlier files, but nothing before that.

Link to comment
Share on other sites

classes changed in that release:

Color4.prototype.copyFrom

Quaternion.Identity

Matrix.prototype.decompose

Matrix.Compose

Tools.Sign

Tools.CreateScreenshot

AsyncLoop

_DepthCullingState

 var partialLoad

Engine constructor

Engine.prototype.createCubeTexture

Engine.prototype.createCubeTexture

SpotLight.prototype.getAbsolutePosition

SpotLight.prototype.computeTransformedPosition

DirectionalLight.prototype.getAbsolutePosition

DirectionalLight.prototype.computeTransformedPosition

ShadowGenerator.prototype.isReady

Scene.prototype.getNodeByName

Mesh.prototype.simplify

Particle.prototype.copyTo

ParticleSystem.prototype.recycleParticle

Animation.prototype.matrixInterpolateFunction

Animation.prototype._interpolate

 

Getting tired. More if asked for

Link to comment
Share on other sites

Hi guys,

 

I'm currently investigating this issue. I had a similar problem while testing with one of my own models exported from Blender, but since the meshes and animations which come with the babylon samples are working with the interpolation functions, I would have not believed the bug was introduced by my code and I did something wrong in Blender itself.

Link to comment
Share on other sites

Hi again,

 

I think I found a clue leading to the problem. I looked into the file exported by Blender:

...    "skeletons": [        {            "name": "Skeleton",            "id": 0,            "bones": [                {                    "name": "pelvis",                    "index": 0,                    "matrix": [                        1,                        0,                        0,                        0,                        0,                        1,                        0,                        0,                        0,                        0,                        -1,                        0,                        0,                        4,                        -0.1425,                        1                    ],...

If you have no rotation, the scale values of the matrix (the values at position 0 (scale x), 5 (scale y) and 10 (scale z)) would be X: 1, Y: 1 and Z: -1. This could lead to the flipped normals problem. These values are created from the Blender exporter which I'm not very familiar with. 

 

Maybe my code did reveal that issue because I multiply with those matrices when I do the interpolation. I'm still looking into this issue, but could anyone who knows the Blender exporter tell me where the value "-1" is coming from? Just to be sure :-)

 

Thank you very much for flagging this bug :-)

Link to comment
Share on other sites

Maybe my code did reveal that issue because I multiply with those matrices when I do the interpolation. I'm still looking into this issue, but could anyone who knows the Blender exporter tell me where the value "-1" is coming from? Just to be sure :-)

 

Cannot help you directly.  Code is below.  Matrix_world comes from skeleton.matrix_world.  I did not write this part. 

@staticmethoddef get_matrix(bone, matrix_world):    SystemMatrix = mathutils.Matrix.Scale(-1, 4, mathutils.Vector((0, 0, 1))) * mathutils.Matrix.Rotation(math.radians(-90), 4, 'X')    if (bone.parent):        return (SystemMatrix * matrix_world * bone.parent.matrix).inverted() * (SystemMatrix * matrix_world * bone.matrix)    else:        return SystemMatrix * matrix_world * bone.matrix

I can say that when I first saw this issue, that I diffed my in-line code generated (similar to .babylon file).  I found that Blender 2.72 generated different values for some position, normals, indices, skeleton weight, & skeleton indices than 2.69.  None of the bones matrices or animations changed. This is why I thought it was something I had done in an unreleased version of the exporter.

 

It did not make any sense that it rendered ok without animation, though.  Gave me a head ache & was not in production, so I worked on something else.  Think that 2.72 must of just generated things in a different vertex order.

Link to comment
Share on other sites

I.m not sure this is related to exporter because rendering works with the same .babylon file so far :(

 

Yeah, I'm not sure too, that was just the first thing that caught my attention.. As far as I know, -1 at this position defines a negative scale at z axis, given you have no rotation:

 

https://www.opengl.org/discussion_boards/showthread.php/159215-Is-it-possible-to-extract-rotation-translation-scale-given-a-matrix

 

 

 

To begin, your scale matrix is of the form 

Code :
[sx 0 0 0]

| 0 sy 0 0|

| 0 0 sz 0|

[ 0 0 0 1]

 

which is really difficult to extract when a rotation was applied:

[ ax*ax*(1-c)+c    ax*ay*(1-c)+az*s  ax*az*(1-c)-ay*s   0]|ax*ay*(1-c)-az*s   ay*ay*(1-c)+c    ay*az*(1-c)+ax*s   0||ax*az*(1-c)+ay*s  ay*az*(1-c)-ax*s   az*az*(1-c)+c     0|[       0                 0                 0           1]
Link to comment
Share on other sites

Thanks for being on top of this guys! I tested the newest version with mine and of course it works. I know you guys have more stuff to work on, but thank you!

 

On the note of animations and blender, does the exporter support multiple animations? I have made multiple animations with the Action Manager and have attached them to Fake Users, but are not showing up anywhere in the imported model. I can make another forum post if needed.

 

Edit: Also wanted to note that I now have two meshes that are attached to my bones and only the first mesh is moving with my animation?

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...