threecsg

Threecsg flat sides when expecting volumetric result

ぐ巨炮叔叔 提交于 2020-02-06 02:46:18
问题 The issue: Subtracting a cube from a sphere provides a result where the z axis retains volume, but the y and x axis produce flat disks, as show in the image. I am not sure why the sphere is losing volume on those sides. I am using a typical subtract with threeCSG. Code: var geometry = new THREE.CubeGeometry( 100, 100, 100 ); var material = new THREE.MeshLambertMaterial( {color: 0xff0000, side: THREE.DoubleSide, transparent:true, opacity: .5} ); var cutter = new THREE.Mesh( geometry, material

Threecsg flat sides when expecting volumetric result

♀尐吖头ヾ 提交于 2020-02-06 02:46:08
问题 The issue: Subtracting a cube from a sphere provides a result where the z axis retains volume, but the y and x axis produce flat disks, as show in the image. I am not sure why the sphere is losing volume on those sides. I am using a typical subtract with threeCSG. Code: var geometry = new THREE.CubeGeometry( 100, 100, 100 ); var material = new THREE.MeshLambertMaterial( {color: 0xff0000, side: THREE.DoubleSide, transparent:true, opacity: .5} ); var cutter = new THREE.Mesh( geometry, material

Three.js - Why is csg.js not working?

谁说胖子不能爱 提交于 2019-12-31 04:22:09
问题 I tried to use csg.js-functions to cut a sphere out of a box, but it is not working? I read the tutorial on http://learningthreejs.com/blog/2011/12/10/constructive-solid-geometry-with-csg-js/ but its still not working. <html> <head> <title>Experiment</title> </head> <body> <script src="three_js\build\three.min.js"></script> <script src="ThreeCSG.js"></script> <script src="csg.js"></script> <script type="text/javascript"> var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(

3D Boolean operations with Three CSG

半腔热情 提交于 2019-12-18 18:31:16
问题 Following the example here: http://learningthreejs.com/blog/2011/12/10/constructive-solid-geometry-with-csg-js/ And using Three.js with https://github.com/chandlerprall/ThreeCSG, I'm trying to do 3D boolean operations on nodes from the model. Like for example if I have a wall with a window, I want to do invert() on that to get just the window. I have a function that returns all the vertices of the polygons of a node, here's an example of vertices of an object without holes https://pastebin

Strange result with ThreeCSG and subtract

喜你入骨 提交于 2019-12-13 08:18:48
问题 I'm learning three.js and for a project i need to create an inersection between a cylinder and a sphere. Here is the interesting part of the code : var sphere_mesh_3 = createSphereMesh(rayon_1, 145, color);//,-2,2,-2,2); sphere_mesh_3.position.z = 6; //scene.add(sphere_mesh_3); var sphere_mesh_4 = createSphereMesh(rayon_2, 145, color);//,-2,2,-2,2); sphere_mesh_4.position.z = 7.5; //scene.add(sphere_mesh_4); function getZmaxRelSurfaceAspherique(mesh) { var zMax = 0; for(var i = 0; i < mesh

Controlling the scaling of custom geometries in Three.js

二次信任 提交于 2019-12-11 16:04:47
问题 I have a custom object which is a subtraction of two meshes. This subtraction creates a frame-like object. createFrame (x, y, z) { const frameMesh = new THREE.Mesh(new THREE.BoxGeometry(1,1,1)); frameMesh.scale.set(x, y, z); const smallerFrameMesh = frameMesh.clone() smallerFrameMesh.scale.set(x - 4, y - 4, z); // subtraction const frameGeometry = fromCSG(toCSG(frameGeometry).subtract(toCSG(smallerFrameMesh))); const frame = new THREE.Mesh(frameGeometry, new THREE.MeshStandardMaterial

Three.js - Merge multiple geometries/meshes removing common areas

拜拜、爱过 提交于 2019-12-04 13:51:27
问题 I´m trying to merge two geometries/meshes (red and blue) into a unique one. But after creating a new geometry and applying geometry.merge() I found that all the inner vertices and faces are still there (the green area). I would like to remove all that extra information, as it generates visual glitches on the rendered faces and also I cannot calculate the merged volume correctly.. I need something like on the last picture, a single mesh that only includes the minimal external/outer faces and

Three.js - Merge multiple geometries/meshes removing common areas

流过昼夜 提交于 2019-12-03 08:57:12
I´m trying to merge two geometries/meshes (red and blue) into a unique one. But after creating a new geometry and applying geometry.merge() I found that all the inner vertices and faces are still there (the green area). I would like to remove all that extra information, as it generates visual glitches on the rendered faces and also I cannot calculate the merged volume correctly.. I need something like on the last picture, a single mesh that only includes the minimal external/outer faces and vertices, removing the inner ones. I tried applying ThreeCSG to subtract meshes but I´m founding that it

Three.js - Why is csg.js not working?

做~自己de王妃 提交于 2019-12-02 04:33:32
I tried to use csg.js-functions to cut a sphere out of a box, but it is not working? I read the tutorial on http://learningthreejs.com/blog/2011/12/10/constructive-solid-geometry-with-csg-js/ but its still not working. <html> <head> <title>Experiment</title> </head> <body> <script src="three_js\build\three.min.js"></script> <script src="ThreeCSG.js"></script> <script src="csg.js"></script> <script type="text/javascript"> var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 ); var renderer = new THREE.WebGLRenderer();

Cross-sections of OBJ in three.js using ThreeCSG

守給你的承諾、 提交于 2019-12-01 12:10:11
I'm trying to make cross-sections of an OBJ loaded with the three.js OBJ loader using the threeCSG wrapper for the JavaScript constructive solid geometry library. When I use a regular mesh (like a sphere/cube), the intersection csg operation works beautifully. I can also make great-looking cross-sections with an obj in its initial position (white object, cross-section displayed in red below): However, when I rotate the object, the cross-section is the same no matter how I change its rotation: How can I get the csg intersection operation to take into account the rotation of the object? It works