I'm having difficulties constructing a hollow cylinder in Three.js.
Should I go and construct it using CSG or by stitching the vertices together?
I'm having difficulties constructing a hollow cylinder in Three.js.
Should I go and construct it using CSG or by stitching the vertices together?
It is unlikely that you would have to stitch vertices together. If your cylinder has no thickness, you can use
THREE.CylinderGeometry()
. If it does have thickness, you can use CSG.This solution uses ChandlerPrall's ThreeCSG.js project: http://github.com/chandlerprall/ThreeCSG
(For now, I recommend using the experimental version that supports materials - the uv branch - http://github.com/chandlerprall/ThreeCSG/tree/uvs)
Here's the code you will need:
Use SVGloader to load a circle of desired radius (as an SVG). Set the geometry to
ExtrudeBufferGeometry
and give it your desired height as depth in the extrude settings object.