Jump to content

Error if skeleton is out of view when scene starts


HugoMcPhee
 Share

Recommended Posts

In a blender scene one of the character meshes has an armature with an animation.

After exporting to a .babylon file and loading it, if the character with the skeleton armature is visible when the scene starts , the animation plays and the scene works as normal,

If the camera is facing away from the animated character when the scene starts this error occurs

 

rclba0.jpg

Uncaught TypeError: Failed to execute 'uniformMatrix4fv' on 'WebGLRenderingContext' : No function was found that matched the signature provided.

(using nw.js based on Chromium 41.0.2272.76.)

 

This is how the scene is loaded

BABYLON.SceneLoader.Load("", "TheBlenderScene.babylon", engine, function (newScene) {        newScene.executeWhenReady(function () {

It's happened in 3 projects, my current workaround has been to include all the animated meshes in the view when the game starts.

Has any one else has had this problem, or have an idea of how to avoid the error? thanks

Link to comment
Share on other sites

Yep here's two test scenes that reproduce the error.
 
Although I found it only happens when "Variance" shadows are enabled (from blender), otherwise it works,
so it looks like varience shadows are causing the error
 
Here's a scene with two animated object in view: 
 
And here's the identical scene with the camera facing away from the animated objects
 
This is what the blender setup looks like
6qbjaa.jpg
 
Here's a zip with all the files (including the blender file)
http://mywobsite.x10.mx/armaturetest.zip
Link to comment
Share on other sites

The skeleton's transformation matrix is not calculated, since prepare is (probably) called only when a camera is targeting the object.

Adding a

this.prepare();//make sure it will recalculate the matrix next time prepare is called.this._isDirty = true; 

at the end of the Skeleton's constructor solved the issue.

@DK - Pull Request follows in a sec. The isDirty = true is actually optional, it works well without it. It is there just to make sure it works as before, just with matrix initialization.

Link to comment
Share on other sites

  • 1 year later...

This seems to be broken (again?) - i am using the 2.5 beta from github (downloaded yesterday).

And I get exactly this problem right on startup:

(I do have a character with a skeleton in the scene and I have a shadowGenerator active on this character. But the character get's moved into view.)

 

Uncaught TypeError: Failed to execute 'uniformMatrix4fv' on 'WebGLRenderingContext': No function was found that matched the signature provided.
  Engine.setMatrices    
  Effect.setMatrices    
  renderSubMesh    
  ShadowGenerator._shadowMap.customRenderFunction    
  RenderingGroup.render    
  RenderingManager.render    
  RenderTargetTexture.renderToTarget    
  RenderTargetTexture.render    
  Scene._renderForCamera    
  Scene._processSubCameras    
  Scene.render    
  (anonymous function)    
  Engine._renderLoop

Link to comment
Share on other sites

Calling this.character.skeleton.prepare() explicitly fixed the problem for me - so thank you very much for this thread and the solution @RaananW !

 

@Deltakosh

Since the fix was the same, this bug really seems to be reintroduced (or the pull request wasn't merged - I have not checked into that.)

Link to comment
Share on other sites

@Deltakosh

Playground that reproduce error and the fixes described in this thread:

(To see the error the browser console has to be opened before pressing run, I am using the latest chrome)

Error:

http://babylonjs-playground.com/#1NXQVV#0

No-Error:

http://babylonjs-playground.com/#1NXQVV#1

The only change: Not rotating the Camera by Math.Pi on Y-Axis. (Which brings the animated mesh back into view of the camera).

No-Error 2:

http://babylonjs-playground.com/#1NXQVV#2

This time camera is still rotated (mesh out of view) but .prepare() is called on the skeleton, this also fixes the error.

Link to comment
Share on other sites

Thank you David, really appreciate it!

Trying to get to know babylon good enough, so I can use it next weekend for a ludum dare submission.

(And this is by no means a breaking bug - but if I hadn't found this thread I would have been pretty confused what causes it.)

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