Skip to content

Commit

Permalink
change the uv coord to usual convention
Browse files Browse the repository at this point in the history
  • Loading branch information
lcp29 committed Feb 16, 2024
1 parent fd1da7a commit 6b949c2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ Find the closest intersection for each ray.

### Returns

> ⚠️ The UV coordinates returned have different convention: `uv[0]` corresponds to the second vertex and `uv[1]` correspongs to the third vertex.
If `stream_compaction` is `False`:
- `hit` (`Bool[torch.Tensor, "*b"]`): A boolean tensor indicating if each ray intersects with the mesh.
- `front` (`Bool[torch.Tensor, "*b"]`): A boolean tensor indicating if the intersection is from the front face of the mesh.
Expand Down
3 changes: 1 addition & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
tri_v = mesh_faces[tri_idx]
tri_norm = mesh_normals[tri_v]
print(tri_v)
# uv[0] -> 2nd, uv[1] -> 3rd, (1 - uv[0] - uv[1]) -> 1st
hit_norm = uv[:, :1] * tri_norm[:, 1] + uv[:, 1:] * tri_norm[:, 2] + (1 - uv[:, :1] - uv[:, 1:]) * tri_norm[:, 0]
hit_norm = uv[:, :1] * tri_norm[:, 0] + uv[:, 1:] * tri_norm[:, 1] + (1 - uv[:, :1] - uv[:, 1:]) * tri_norm[:, 2]
loc[hit] = hit_norm
plt.imshow(loc.cpu())
plt.show()
Expand Down
2 changes: 1 addition & 1 deletion triro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = '0.0.2'
__version__ = '1.0.0'
2 changes: 1 addition & 1 deletion triro/backend/shaders.cu
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extern "C" __global__ void __closesthit__intersectsClosest() {
uv.x * verts[1].z + uv.y * verts[2].z + (1 - uv.x - uv.y) * verts[0].z};

result->triIdx = triIdx;
result->uv = uv;
result->uv = {1 - uv.x - uv.y, uv.x};
result->hit = true;
result->front = optixIsFrontFaceHit();
result->loc = isectLoc;
Expand Down

0 comments on commit 6b949c2

Please sign in to comment.