0

I'm using indexed BufferGeometry for raytracing. Which means I have a flat list of unique vertices and index buffer for faces. How can I add custom attribute per vertex of face? As far as I understand the size of each attribute buffer should match the size of position buffer.

user1617735
  • 451
  • 5
  • 16
  • Try converting to non-indexed. `geo2 = bufferGeometry.toNonIndexed()`. – WestLangley Mar 25 '16 at 20:18
  • I kinda need indexed for less memory (my meshes are 1-1.5 mil tris) and raycasting. – user1617735 Mar 25 '16 at 20:33
  • 1
    Vertices can only be shared if they have the same values on all attributes. – WestLangley Mar 25 '16 at 23:29
  • Gotcha. So if I need both custom attributes and face picking on BufferGeometry, it's not doable? – user1617735 Mar 26 '16 at 06:38
  • (1) Sorry, I do not understand that question... (2) Maybe you should be doing GPU picking with meshes that big. – WestLangley Mar 26 '16 at 10:46
  • (1) I apologize, I'll try to be more clear. I have a big mesh, as I already stated, so my natural choice was BufferGeometry. I've tried regular Geometry and ended up "out of memory" on FF. Next I need to pick faces, so I've used indexed geometry, since I've read one needs indexed for raytracing. That also helped me, since sharing vertices also cuts down on memory. (2) GPU picking sounds just about right, as I've noticed raytracing with BufferGeometry is really slow. Could you perhaps share some links to examples of GPU picking with THREE.js? Thanks! – user1617735 Mar 26 '16 at 11:16
  • 1
    http://threejs.org/examples/webgl_interactive_cubes_gpu.html and http://stackoverflow.com/questions/17739760/complex-shape-character-outline/21863009#21863009. – WestLangley Mar 26 '16 at 12:22
  • Unfortunately, that's not what I need. What it does is object picking, while I need to pick faces on a single object, currently I do it with raytracing, which returns face index. I've also found this http://brianxu.github.io/GPUPicker/ implementation, which picks faces, but it clones the entire scene to render to offscreen, which is bad idea in my case of gigantic mesh. – user1617735 Mar 27 '16 at 05:35

0 Answers0