Azure / azure-remote-rendering

SDK and samples for Azure Remote Rendering
MIT License
106 stars 38 forks source link

[Question] Returning triangle index of a raycast #43

Closed sidoverflow closed 3 years ago

sidoverflow commented 3 years ago

Hi folks. I am trying to obtain the triangle index of a raycast hit on a remotely rendered model. Is this possible?

From what I understand, the SubPartId field from a RayCastHit is not the triangle index. Couldn't find anything else about this.

MalcolmTyrrell commented 3 years ago

Hi.

There's no way to get the triangle index from the result of a raycast. The SubPartID can be used to identify which portion of the mesh at an entity was hit by identifying the material. See:

The triangulation of meshes during conversion means that we do not guarantee a 1-1 mapping between faces in the source asset and at runtime. Additionally, no API is exposed for manipulating meshes at a per-triangle level, so knowing a particular triangle index would have little benefit.