简体   繁体   中英

Construct 3D geometry with PHP?

I need to construct 3D models for use with Three.js , but I need to do CSG (Constructive Solid Geometry) operations on them too. I managed to use the ThreeCSG.js library for this, but I find this to be quite slow (about 5 seconds to slice about 30 holes from a complex shape).

Somehow I need to cache the geometry that is constructed, but since the construction of 3D geometry now happens only on the client side in the browser (with Javascript) I have no way of doing this on the server , which uses PHP.

  • Are there any 3D libraries in PHP (that can do CSG as well) ?
  • What's the best way to pre-calculate 3D models for later use in Three.js ?

I highly doubt you will find good 3D libraries in PHP. If you can't install other software on the server, you could generate it on client side first run and send it to server. Subsequent request would then be served that cached file. I do something like this.

Take a look at http://mrdoob.github.io/three.js/examples/js/exporters/GeometryExporter.js . There is also ObjectExporter and SceneExporter. You can use GeometryExporter to save the generated geometry to Three.js JSON

Three.js r59

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM