Attempting to apply a dynamic geometry skin, I encounter an issue after setting
material.skinning = true
An error message about shader compilation pops up stating "too many uniforms". Despite my understanding of the problem and discovering this closed Github Issue, no solution was provided. The perplexing part is that even with minimal geometry and bones in my Object, the number of uniforms seems to exceed max capacity (>1024 based on my Max Uniform Vector's value from here) due solely to skinning=true
.
This is the code snippet:
var material = new THREE.MeshLambertMaterial({color: 0xAABBAA, skinning: true});
var maxLength = Math.max(geom.vertices[0].y, geom.vertices[geom.vertices.length-1].y);
for(var i = 0; i < MAXRESOLUTION; i++){
var skinIndex = geom.vertices[i].y > 0? 1 : 0;
var skinWeight = Math.abs(geom.vertices[i].y/maxLength);
geom.skinIndices.push( new THREE.Vector4( skinIndex, skinIndex + 1, 0, 0 ) );
geom.skinWeights.push( new THREE.Vector4( 1 - skinWeight, skinWeight, 0, 0 ) );
}
var newMesh = new THREE.SkinnedMesh(geom, material);
skeleton.bones[0].position.y = geom.vertices[0].y;
skeleton.bones[1].position.y = -geom.vertices[0].y;
var root = skeleton.bones[0];
newMesh.add(root);
newMesh.bind(skeleton);
Your assistance is greatly appreciated :)
r75