Hi All,
I’m working on a scene that renders some LineSegments as a wireframe: https://bl.ocks.org/duhaime/b50c3230238ff88c1779cef1fe02f7a7
I now want to slowly move the vertices in the LineSegments material (this object is named warehouse
in the scene above).
The easiest way I’ve found to slowly move vertices is to use a RawShaderMaterial, provide both currentPosition
and targetPosition
attributes for that geometry, and use a transitionPercent
uniform that controls the mixture of each position in the rendered vertex position:
vec3 pos = mix(currentPosition, targetPosition, transitionPercent)
However, when I try to use a RawShaderMaterial for the warehouse in the scene above, I lose the wireframe geometry on the warehouse, as setting wireframe = true
on a RawShaderMaterial doesn’t have the same effect as it does on the LineBasicMaterial
.
I tried a few things to create a wireframe geometry that I could pass to my RawShaderMaterial, like:
var g1 = new THREE.BufferGeometry();
g1.addAttribute('position', new THREE.BufferAttribute(positions, 3));
var g2 = new THREE.Geometry().fromBufferGeometry(g1),
wireframe = new THREE.WireframeGeometry(g2),
geometry = new THREE.BufferGeometry().fromGeometry(wireframe);
But all attempts have failed to unlock the secret.
Does anyone know how I can render the warehouse
object above as a wireframe using a RawShaderMaterial? I’d be super grateful for any help others can offer on this question!