render in wireframe #4336
Replies: 5 comments 3 replies
-
Hey there! I think to get the desired result you'll need to use the addPass() in the Custom Effects section of the Post Processing Effects. Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Hi @phatpixels ! Three.js has a I just added a wireframe rendering mode to my current project (see the source code of Kitsu) To reach this goal, I create a new material variant from my 3D model (see |
Beta Was this translation helpful? Give feedback.
-
Edit: I was just stupid, you can hook it and use scene.traverse as you would with threejs. Sorry.. var mvElement = document.getElementById("mv-element");
var scene =
mvElement[
Object.getOwnPropertySymbols(mvElement).find(
(e) => e.description === "scene"
)
];
// traverse the scene and set wireframe to true
scene.traverse(function (child) {
if (child.isMesh) {
child.material.wireframe = true;
child.material.color.setHex(0xff0000); // sets color
}
});
Hi, I was wondering if you could provide the code example of that, as either I am too stupid to figure it out or I am missinterpreting what you wrote. |
Beta Was this translation helpful? Give feedback.
-
I started with @NicoPennec answers but figured out that while it was working as expected at the first glance. Then I discovered that you can basically disable the material texture using the map option of Three.js . Here is the final code to create the wireframe variant, based on the source code of Kitsu already linked above: createWireframeVariant(model) {
const maxIndex = model.materials.length
for (let i = 0; i < maxIndex; i++) {
const variantMaterial = model.createMaterialInstanceForVariant(
i,
`material-wireframe-${i}`,
'variant-wireframe',
this.isWireframe
)
if (!variantMaterial) {
continue
}
const texture = variantMaterial.normalTexture
const materialsSymbol = Object.getOwnPropertySymbols(texture).find(
symbol => symbol.description === 'materials'
)
const materials = texture[materialsSymbol]
materials.forEach(material => {
material.wireframe = true // Enable the wireframe
material.map = false // Disable the texture
})
}
} |
Beta Was this translation helpful? Give feedback.
-
Its posible to see only the edges? Like CAD view? |
Beta Was this translation helpful? Give feedback.
-
Hi All,
Is there a way to display the model in simple wireframe view? say switch modes from fully textured to simple wireframe to see model construction. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions