How to create outlines with different colors at same time

In my project i use three.js created many Mesh with ShapeGeometry,i want to create outlines to every ShapeGeometry with different colors,can you give me any help?
like this sample but i want to create outlines to every ShapeGeometry with different colors at same time : https://threejs.org/examples/?q=outline#webgl_postprocessing_outline

One way to solve it: You store a color value for each mesh in Object3D.userData like so:

shapeMesh.userData.outlineColor = new Color( 0xffffff * Math.random() );

When you select an object, you access this color value and set it to the visibleEdgeColor property of OutlinePass.

1 Like

Can I select multiple shapes in this way and display their outline in different colors at the same time?

It’s possible to select multiple objects but not in different colors. OutlinePass can only handle a single color for the outline effect.

1 Like