Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
ThreeJS - Assigning Individual Colors to Lines in an Icosahedron Wireframe

I'm working on rendering an icosahedron wireframe using threejs and react-three/fiber. I'd like to be able to change the color of an individual line in the frame.

This is the code I have currently:

import { Canvas } from "@react-three/fiber";
import ReactDOM from "react-dom";

function Icosahedron(
  props: JSX.IntrinsicElements["mesh"] | JSX.IntrinsicElements["line"]
) {
  return (
    <Canvas style={{ width: "100vw", height: "100vh" }}>
      <ambientLight />
      <pointLight position={[10, 10, 10]} />
      <mesh position={[0, 0, 0]}>
        <icosahedronGeometry args={[2, 1]} />
        <meshStandardMaterial
          wireframe={true}
          color="black"
          wireframeLinewidth={10}
        />
      </mesh>
    </Canvas>
  );
}

ReactDOM.render(<Icosahedron />, document.getElementById("root"));

Which produces the following result: Icosahedron where all line colors are the same.

What I'm looking for is this: Icosahedron where one line is a different color (blue).

I've tried the following:

  1. Rendering the wireframe through the LineSegments geometry, and providing an array of materials instead of a single one. This just ends up with a blank canvas and no console error output.

  2. Binding a ref to the icosahedronGeometry, accessing the position attribute and rendering another line to cover the wireframe line. This seems bulky and inefficient.

Is there a simple way to change the colors of the lines individually?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!