Jump to content

Mobile safari babylon bone limit?


petemac
 Share

Recommended Posts

Hello

 

Does mobile safari have a limit of bones per mesh?

When I load a mesh with 30 bones from blender, it loads and displays fine.

However when I add one more bone and load the mesh with 31 bones it doesnt display on screen.

Ive tried numerous times with different models and no luck.

The mesh still displays perfectly in Google Chrome on my laptop.

It also displays perfectly in sandbox on my laptop.

Is there some sort of limitation on safari mobile? The Iphone6? Babylon?

 

Link to comment
Share on other sites

Hello,

 

the limit is not really in the number of bones but in the number of variables allowed for a single shader. Babylon tries its best to compile the simpler shader possible but sometimes the browser is limiting what we can do

 

Two options:

- Remove bones

- Uses software skinning: mesh.computeBonesUsingShaders = false

Link to comment
Share on other sites

Thank you!

 

Using mesh.computeBonesUsingShaders = false works perfectly!

 

However, I am curious.

 

If I have a mesh with 30 bones, but 31 bones puts me over the limit by 1 bone.

 

Will two seperate mesh with 30 bones put me over the limit for shader uniforms?

 

The only drawback is that this operation can consume a lot of shaders uniforms (a limited resources representing the variables that can be sent from the CPU). On low-end devices this may be a problem as bones can swallow all the uniforms.
Link to comment
Share on other sites

Would it be possible to make the following changes to:

 

vertexData.ts, and the definitions of methods that call it:

    export interface IGetSetVerticesData {        isVerticesDataPresent(kind: string): boolean;        getVerticesData(kind: string, copyWhenShared?: boolean): any[];        getIndices(copyWhenShared?: boolean): number[];        setVerticesData(kind: string, data: any[], updatable?: boolean): void;        updateVerticesData(kind: string, data: any[], updateExtends?: boolean, makeItUnique?: boolean): void;        setIndices(indices: number[]): void;    }    export class VertexData {        public positions: any[];        public normals: any[];        public uvs: any[];        public uvs2: any[];        public uvs3: any[];        public uvs4: any[];        public uvs5: any[];        public uvs6: any[];        public colors: any[];        public matricesIndices: any[];        public matricesWeights: any[];        public indices: number[];        public set(data: any[], kind: string) {         ...

Then when update is requested, check if instanceof Array<number>, and only then make a throw away typed array for transmission, otherwise it is already in transmission form.  All existing code should work, but this will have the following advantages:

 

  1. Whatever type you give SetVertexData() is what will get saved (by reference).
  2. updateVerticesDataDirectly() can be removed or depreciated.
  3. I could morph verts as float32Array using SIMD & dirty bones in the same frame, & still go the cpu bone update route.

In my Morph 2.0, under dev, I would directly set the VertexData elements directly (they are public) when also doing a bone interpolation in the same beforerender call to avoid double transmission.  When morphing only, just call updateVerticesData(), and it should behave as updateVerticesDataDirectly() would.

 

One other note, could not the need to use the cpu bone update be detected using EngineCapabilities?

Link to comment
Share on other sites

Will do, not sure when. 

 

I see that there is a MAX_VERTEX_UNIFORM_VECTORS capability https://www.browserleaks.com/webgl .  Would this work? Could put a method on skeleton like requiresCPUProcessing() if so. Have not completely thought this out, just trying have a way that this could be figured out at runtime, not hardcoding.  I am probably not a good choice for this part.

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