Hello! I’m working on a project where I need to surround a human-shaped OBJ file with a rectangular mesh for visual effects.
I am struggling to figure out how to accurately align and size the rectangular mesh around the human-shaped model. How can I calculate the dimensions and position of the mesh so that it fits snugly around the model?
I want the rectangular mesh to completely surround the human-shaped model without any gaps or overlaps. The mesh should adjust its size and position based on the dimensions of the model.
from the collection, a model is loaded to its internal position and enclosed with a box. Then it is moved to another position. Of course, you can also move the box with it.
I appreciate your help and I would like to clarify my question a bit more. My current project involves a mesh that is made up of triangles, and I am interested in converting this triangular mesh into a quadrilateral mesh. I was wondering if this is possible in Three.js, and if so, what methods or approaches would you recommend for achieving this?
To give you a bit more context, here is a snippet of my current code:
function toggleMeshDisplay() {
if (scene) {
scene.traverse((object) => {
if (object instanceof THREE.Mesh) {
if (object.wireframeMesh) {
object.remove(object.wireframeMesh);
}
object.material.color.set(0xffffff);
if (meshChecked) {
const wireframeGeometry = new THREE.WireframeGeometry(
object.geometry
);
const wireframeMaterial = new THREE.LineBasicMaterial({
color: 0xffffff,
});
const wireframeMesh = new THREE.LineSegments(
wireframeGeometry,
wireframeMaterial
);
object.add(wireframeMesh);
object.wireframeMesh = wireframeMesh;
}
}
});
}
}
I have been trying to find a solution in the documentation and through various forums, but I haven’t been able to figure out exactly how to make this conversion. Any advice or suggestions would be greatly appreciated!
Is it possible to cover the surface of a human face model, represented as an OBJ file, with a quadrilateral mesh? Currently, my code is set up to handle triangular meshes, and I’m curious to find out if there’s a way to adapt it to work with quadrilateral meshes instead. Any guidance on how to achieve this would be greatly appreciated.
Here’s my current code!
function toggleMeshDisplay() {
if (scene) {
scene.traverse((object) => {
if (object instanceof THREE.Mesh) {
if (object.wireframeMesh) {
object.remove(object.wireframeMesh);
}
object.material.color.set(0xffffff);
if (meshChecked) {
const wireframeGeometry = new THREE.WireframeGeometry(
object.geometry
);
const wireframeMaterial = new THREE.LineBasicMaterial({
color: 0xffffff,
});
const wireframeMesh = new THREE.LineSegments(
wireframeGeometry,
wireframeMaterial
);
object.add(wireframeMesh);
object.wireframeMesh = wireframeMesh;
}
}
});
}
}
Rendering quads is something you’ll have to work on creating a shader solution for, I think I’ve seen another question on this forum before as well as SO questions
This isn’t something that’s entirely straight forward in creating
Thank you for your response. As you mentioned, it seems like this task is going to be quite overwhelming for me. I think I need to look for some alternative solutions.
How do you snugly fit a rectangle to your model ? If its a rectangle then its just a cube. If you mean you want to surround your model with the same model but made out of rectangles, then i suggest a 3D program editing, like Blender. Make a copy of your model, then simply quadrify your copied model. This will remove the trigons and you have an exact copy of your model, but with quads. If you want to decrease the quality and polygons for performance of your quad model, then I recommend a remesh tool or decimate. If you have your new model, make sure that the origin matches with your original model. Then in code just simply scale and position both models at the same time or copy. If your model has armature, then simply make sure the quadrified model has the same weights on it as the original.