(Sphere) Geometry just wireframe but without diagonal lines

Hi,

I think the titel says it all: Is there a way to generate a SphereGeometry with Wireframe(Material) but without showing/drawing the wireframe its diagonal lines?

Hi!
I see two options:

  1. To change .index attribute of THREE.SphereBufferGeometry().
  2. Build such sphere of circle lines.

You might want to try THREE.EdgesGeometry.

https://jsfiddle.net/f2Lommf5/13132/

3 Likes

I definitively want to try [THREE.EdgesGeometry] ! :slight_smile:

Out of curiosity, do you have a definition of what makes a line “diagonal”?

Just remembered about that fiddle I’ve made about two years ago:
http://jsfiddle.net/prisoner849/4p9kp1p2/

2 Likes

I’m also curious if there is a way to just edit the code that creates wireframes (to remove the diagonal line) as opposed to using THREE.EdgesGeometry. Anyone get that far?

Having this: Wireframe of quads
and this: three.js examples

we can get this example: https://jsfiddle.net/prisoner849/so70a51h/

Picture:
изображение

Function:

function SphereToQuads(g) {
  let p = g.parameters;
  let segmentsX = p.widthSegments;
  let segmentsY = p.heightSegments-2;
  let mainShift = segmentsX + 1;
  let indices = [];
  for (let i = 0; i < segmentsY + 1; i++) {
    let index11 = 0;
    let index12 = 0;
    for (let j = 0; j < segmentsX; j++) {
      index11 = (segmentsX + 1) * i + j;
      index12 = index11 + 1;
      let index21 = index11;
      let index22 = index11 + (segmentsX + 1);
      indices.push(index11 + mainShift, index12 + mainShift);
      if (index22 < ((segmentsX + 1) * (segmentsY + 1) - 1)) {
        indices.push(index21 + mainShift, index22 + mainShift);
      }
    }
    if ((index12 + segmentsX + 1) <= ((segmentsX + 1) * (segmentsY + 1) - 1)) {
      indices.push(index12 + mainShift, index12 + segmentsX + 1 + mainShift);
    }
  }
  
  let lastIdx = indices[indices.length - 1] + 2;
  
  // poles
  for(let i = 0; i < segmentsX; i++){
  	//top
    indices.push(i, i + mainShift, i, i + mainShift + 1);
    
    // bottom
    let idx = lastIdx + i;
    let backShift = mainShift + 1;
    indices.push(idx, idx - backShift, idx, idx - backShift + 1);
  }
  
  g.setIndex(indices);
}
1 Like