Hello everyone, please tell me, I want to achieve the effect of tracing the model and highlighting its lines, as in the picture, but the object remains blue. How can you make such an effect, I don’t understand anything, thank you!
project code – code
Примеры как должно быть:
My Model and Project:
I tried this option and got this result: enter image description here
code:
// Uploading your model (.glb or .gltf)
const loader = new GLTFLoader();
loader.load(
'/models/825001.glb', // The path to your model
(gltf) => {
const model = gltf.scene;
// We change the materials of the model to white
replaceMaterialsWithWhite(model);
//Adding a model to the scene
scene.add(model);
// Updating OutlinePass after loading the model
outlinePass.selectedObjects = [model];
},
undefined,
(error) => {
console.error('Model loading error:', error);
}
);
// Post-processing with stroke effect
const composer = new EffectComposer(renderer);
const renderPass = new RenderPass(scene, currentCamera);
composer.addPass(renderPass);
const outlinePass = new OutlinePass(new THREE.Vector2(window.innerWidth, window.innerHeight), scene, currentCamera);
outlinePass.edgeStrength = 5.0; // The strength of the visible stroke (increase the value for a thicker stroke)
outlinePass.edgeGlow = 0.0; // Светящийся эффект (0 - отключен)
outlinePass.edgeThickness = 2.0; // Stroke thickness
outlinePass.pulsePeriod = 0; // Ripple animation (0 - disabled)
outlinePass.visibleEdgeColor.set(0x000000); // black outline color
outlinePass.hiddenEdgeColor.set(0x000000); // Black outline color for hidden parts
composer.addPass(outlinePass);