question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Morph targets broken on some mobile devices using WebGL 2

See original GitHub issue

Describe the bug When I load a glTF model with more than a certain number of shape keys (Morph Targets), the mesh is not visible in the cell phone browser

This is a question I posted in the forum and could not resolve. https://discourse.threejs.org/t/gltf-morph-animation-retention-limits/41762/3

Steps to reproduce the behavior:

  1. export a mesh with more than a certain number of shape keys (more than 241 in my environment) to glTF in Blender.

  2. browse it in any glTF viewer.

  3. the mesh will no longer be visible in the mobile web browser. (However, it will be visible in the desktop web browser.)

The cell phones I am checking are as follows ViVO iQOO neo3 5G (Android 10 / Chrome 104.0.5112.97 ) ASUS ZenFone 3 ( Android 8 / Chrome 104.0.5112.97 ) AQUOS SHV38 ( Android 8 / Chrome 98.0.4758.101 )

If you have any other additional requests, please let me know.

Code

	const loader = new GLTFLoader();
	loader.load( 'test2.glb', function ( gltf ) {

		mesh = gltf.scene.children[ 0 ];
		console.log("mesh.children.length:" + mesh.children.length)

		scene.add( mesh );
		mixer = new THREE.AnimationMixer( mesh );
		for (let i = 0; i < gltf.animations.length; i++ ) {
			mixer.clipAction( gltf.animations[ i ] ).play();
		};

	} );

Live example http://niu.re/t/test2.html

Screenshots https://user-images.githubusercontent.com/868060/187014170-e26b4130-1adf-485e-b1c6-7dc989ca234c.mp4

ViVO iQOO Neo3 5G 0ca4b2f0fee3445a32522d6f2d0230ab1a3d7c76_2_224x500 fb1fe7de8f9afc3d0c7a5029218284cfe9f703e9_2_224x500 69f94f4e1c5aff0e009ff175bd1a7b82fec5b15b_2_224x500

Platform:

  • Device: [Desktop, Mobile]
  • OS: [Windows, Android]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Three.js version: [r144, r142, r88]

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
Mugen87commented, Aug 30, 2022

When using WebGL 2, the implementation supports unlimited morph targets. unlimited means in this context whatever your device supports.

I suppose the problem on your devices is the maximum number of uniform vectors of 256. Since morphTargetInfluences are passed to the shader as an array of floats, you hit a device limitation with such a complex morph target model. Desktop devices have a higher maximum number of uniform vectors e.g. 1024.

For now, you probably have to reduce the morph target count by simplifying the model. Alternatively, we could consider to make morphTargetInfluences to a data texture (but only for the WebGL 2 code path), and sample it in the shader.

1reaction
niuincommented, Aug 30, 2022

Thank you for your reply.

I have checked by connecting my cell phone with debugging. It seems that I am getting the following error.

Program Info Log: invalid shaders 
ERROR: too many uniforms

WebGLRenderer ( test2.html ) 2022-08-30 (5) 2022-08-30 (6)

WebGL1Renderer ( test3.html ) 2022-08-30 (4)

I will upload the console log as well. niu.re-1661863509115.log

I sincerely hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

3d - Three.js MorphTargets - Stack Overflow
I have been working with the WebGL Morph Targets example (see link below). It seems to set a value between 0 and 1...
Read more >
Issues · mrdoob/three.js · GitHub
Morph targets broken on some mobile devices using WebGL 2 Device Issue Enhancement. #24545 opened Aug 27, 2022 by niuin.
Read more >
Phones with Mali GPU fail with Webgl2, when Chrome ...
Issue 868679: Phones with Mali GPU fail with Webgl2, when Chrome memory cause some strange bug. Reported by schedule hexer.
Read more >
WebGL - Experiments with Google
Little experiment visualising Kinect data with WebGL. ... An interactive 3D gallery of cars from the 60's made in WebGL and optimized for...
Read more >
Hardware-Related Issues - Soft8Soft
Add for each shape key (Blender) / morph target (3ds Max) / blend shape target (Maya). Maximum amount of attributes for this category...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found