question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Raycaster only works on the first triangle of the BufferGeometry

See original GitHub issue
Description of the problem

I have textured quads built using BufferGeometry with 4 vertices. It is in fact rendered using rasterMesh.drawMode = THREE.TriangleFanDrawMode.

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:40 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
donmccurdycommented, Jun 11, 2020

glTF allows triangle strips, how is three.js not allowing triangle strips “pigeon-holing”?

@Dmarcoux111 that a feature exists in WebGL is not a sufficient argument. We maintainers have to deal with feature requests and bug reports or supposed bug reports (why does ____ not work?) that consume our time. Every time someone reports that raycasting doesn’t work, or skinning is broken, we have to investigate why that is. Maintaining and debugging code paths for different draw modes cost us time and energy that could be spent on other things, and especially when features don’t work in all cases, we get more bug reports.

If you’d like to share specific performance numbers about why triangle strips are really better for your application, that would be a better line of argument than saying we have to maintain abstractions for this just because it exists in WebGL.

1reaction
Mugen87commented, Dec 1, 2019

Some more thoughts about this topic:

In context of lines, we have Line, LineLoop and LineSegments which implicitly encode the draw mode and other primitive specific information (e.g line distances).

In Mesh, we just have a drawMode property instead. So the current design was never consistent. It would be if there were something like TriangleMesh, TriangleFanMesh and TriangleStripMesh. But I don’t think it’s beneficial to have such classes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get intersected face when raycasting against buffer ...
Did I get it correctly, that first, you find a face index of a buffer geometry, and then you convert that geometry into...
Read more >
Raycaster#intersectObjects – three.js docs
This class is designed to assist with raycasting. Raycasting is used for mouse picking (working out what objects in the 3d space the...
Read more >
What object3D properties are required to make rayCaster ...
I am calling raycaster.intersectObjects(myObjects) on this list of original Object3D's. I'm wondering what properties are required for this ...
Read more >
Three.js Picking
Probably the most common way of picking is by doing raycasting which means to ... If your scene has 1000 objects and each...
Read more >
npm:three-mesh-bvh - Skypack.dev
BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; THREE.Mesh.prototype.raycast = acceleratedRaycast; // Generate geometry and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found