Hi have a nice day , i try to make a simplex noise to gltf model (create it in blender) ,
The first problem is i cannot access to vertices so i found a way, no error but nothing happen
that’s my code
var k = 1.9;
let update = () => {
var time = performance.now() * 0.0009;
var vertex = new THREE.Vector3();
var positionAttribute = mesh.geometry.getAttribute('position');
for (var i = 0; i < positionAttribute.count; i++) {
vertex.fromBufferAttribute(positionAttribute, i);
let p = vertex;
p.normalize().multiplyScalar(1 + 0.09 * simplex.noise3D(p.x * k, p.y * k, p.z * k + time));
}
mesh.geometry.computeVertexNormals();
mesh.geometry.normalsNeedUpdate = true;
mesh.geometry.verticesNeedUpdate = true;
}
Without a glitch it is difficult to see what might be wrong. I use something similar on a gltf model, so it can work. Do you perhaps have multiple meshes, and only address one (just guessing now)?.
This part needs one more line at the end: positionAttribute.setXYZ(i, p.x, p.y, p.z);
As you’re reading the data from attribute, putting it in vertex, then compuing the values with noise, but not changing values of the attribute.
And after all you need to set .needsUpdate to true for attributes of positions and normals.
These properties are useless, if you use a buffer geometry.
With that type of geometry you have to use those ones, that applied to geometry’s attributes:
Also, is it possible to provide an editable example, that demonstrates the issue? jsfiddle, codepen etc.