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

233
Views
Customize PlaneGeometry edges for each segment in ThreeJS

Currently PlaneGeometry has an option to change segment width and height but this has no effect on edges. Each segment currently has indexed positions to create an 'N' shape when viewing the geometry in wireframe mode:

Indexes currently are:

  • 0 = South West
  • 1 = North West
  • 2 = South East
  • 3 = North East

This gives us an 'N' shape for each segment with wireframes, however instead of this 'N' Shape i would like to create an 'X' shape with edges for every segment. Currently i'm using planes to create different heights and having an 'X' shape would make the result look less edgy shaped (screenshots below).

I think all required vertices already exists, but how is it possible to get an extra edge between point 0 and 3 for each segment?

I've tried looking for the answer online but couldn't find a clear answer on this matter, besides many articles are older than version R125 which made breaking changes to Geometries. Currently I'm using version R135.

I'm guessing i will need to create a custom Buffer Geometry, but am in doubt of how to execute this properly and not losing too much performance.

Current

Desired Edges

  • All red and blue lines are currently existing edges in wireframe mode.
  • All green lines are desired and currently not existing, what would be the best way to do this without losing performance?

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It took me a fair amount of attempts but in the end it didn't turn out to be too hard. I've created this custom PlaneGeometry by creating a custom BufferGeometry. Although it's probably 3x heavier to use;

At the moment it holds 36 (12 * 3) positions per tile segment as where the default PlaneGeometry holds 12 (4 * 3) positions. Although i'm not sure if 3x more positions automatically means 3x more performance usage, but it definitely uses more than the default PlaneGeometry.

Here are the results (changes in height smoothen out prettier):

Desired Geometry Height Changes

Code to create the geometry:

    const geometry = new THREE.BufferGeometry();
    const vertices = new Float32Array([

        // (North Face)
        .5, -.5, 0, // 0:  Center
        1, -1, 0,   // 1:  NE
        1, 0, 0,    // 2:  NW

        // (East Face)
        .5, -.5, 0, // 3:  Center
        0, -1, 0,   // 4:  SE
        1, -1, 0,   // 5:  NE

        // (South Face)
        .5, -.5, 0, // 6:  Center
        0, 0, 0,    // 7:  SW
        0, -1, 0,   // 8:  SE

        // (West Face)
        .5, -.5, 0, // 9:  Center
        1, 0, 0,    // 10: NW
        0, 0, 0,    // 11: SW

    ]);

    geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 
    const material = new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true  } );
    const mesh = new THREE.Mesh( geometry, material );

    mesh.rotation.x = - Math.PI / 2;
    scene.add( mesh );
about 4 years ago · Juan Pablo Isaza Report
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!