Geometry of purely custom attributes does not render at all (position must be set)

Description of the problem

BufferGeometry with only custom attributes does not render in r84. Said geometry used to render in r79 (I think the issue was introduced in r81).


let geometry = new THREE.BufferGeometry();
geometry.addAttribute('gc_position_x', new THREE.BufferAttribute(positionsX.value, 1));
geometry.addAttribute('gc_position_y', new THREE.InterleavedBufferAttribute(positionsY, 1, c , false));
geometry.setDrawRange(0, N);  

This used to render just fine in r79. In r84, I have to add the following line to get it to work:

geometry.addAttribute('position', new THREE.BufferAttribute(positionsX.value, 1));

I don’t even declare position in the shader but three.js r84 still forces me to add the attribute. I think the behaviour from r79 was better. Can this be re-introduced?

Thanks in advance!

Three.js version
  • Dev
  • r84
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
  • All of them
  • Windows
  • Linux
  • Android
  • IOS
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

1 thought on “Geometry of purely custom attributes does not render at all (position must be set)

  1. The problem is this line:

    var drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1;

    Even if you specify a custom drawRange the Math.min call will reset it to zero because it thinks that there are no vertices.

    The only solution I can think of without breaking backward compatibility is blindly obeying the drawRange but only if neither index nor position attributes are defined. What I would actually prefer is always obeying drawRange even if it seems to exceed the dataCount and let the developer deal with it but that might break some existing code.

Comments are closed.