I’m trying to achieve the following effect with three.js in 3d for a visualizer for 3d printing. I need to be able to gradually change the color and the size(or shape) of the extrusion along a single extruded path. It is possible?
How do you generate your geometry right now? With THREE.Shape
and THREE.ExtrudeBufferGeometry
? Changing the size of the extrusion is only possible if you recreate the geometry (which is an expensive process). Besides, the built-in geometries don’t generate a color attribute which could be useful in your case.
So it seems you have to generate these data and the respective changes by yourself.
Thank you for the information. Yes, those are the functions I’m using. Can you point me to the functions I should be looking into to generate the data? I’m completely new to three.js and 3d graphics.
There are no functions for this. You have to write this code by yourself.
It will be not trivial to implement something like this under these circumstances. Maybe you start with generating a color attribute for your extrude geometry. You can study the official examples to see how this is done. For example:
Also read:
https://threejs.org/docs/#api/core/BufferGeometry
https://threejs.org/docs/#api/core/BufferAttribute