Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying transformations to Trimesh breaks intersects_location with embree #2324

Open
Willy19921992 opened this issue Nov 9, 2024 · 0 comments

Comments

@Willy19921992
Copy link

After importing a mesh and applying a transformation, embree suddenly stops returning any hits. I've made a simple program that replicates the issue.

import numpy as np
import trimesh

mesh = trimesh.load_mesh('model.obj', validate=True, use_embree=True)
mesh.apply_scale(1/64)
mesh2 = trimesh.load_mesh('model.obj', validate=True, use_embree=False)
mesh2.apply_scale(1/64)

point = np.array([64/64, 24/64, 64/64])
dir = np.array([0, 0, 1])

print(mesh.ray.intersects_location([point], [dir], multiple_hits=False))
print(mesh2.ray.intersects_location([point], [dir], multiple_hits=False))

Which prints the following:

(array([], shape=(0, 3), dtype=float64), array([], dtype=int64), array([], dtype=int32))
(array([[ 1.   ,  0.375, 19.   ]]), array([0]), array([1]))

If i remove the apply_scale call, embree starts working again. I've also tried to scale the model in Blender, then importing the scaled model and embree works just fine. Setting multiple_hits to True doesn't change the behaviour.

Im using Python 3.12.7, Trimesh 4.5.2, rtree 1.3.0, embree 4.3.3 and embreex 2.17.7.post5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant