{"id":3988,"library":"embreex","title":"Embreex","description":"Embreex is a Python binding for Intel's high-performance Embree ray tracing kernel. It is a fork of `scopatz/pyembree`, created to provide pre-built wheels for Intel Mac, Windows, and Linux across various Python versions (3.8+), aiming for minimal dependencies. The library is actively maintained with regular updates and includes a release candidate for a new major version.","status":"active","version":"2.17.7.post7","language":"en","source_language":"en","source_url":"https://github.com/trimesh/embreex","tags":["ray tracing","rendering","graphics","3D","embree","scientific computing"],"install":[{"cmd":"pip install embreex","lang":"bash","label":"Latest stable version"}],"dependencies":[{"reason":"Required for defining mesh data (vertices, faces) and ray data (origins, directions) in typical usage examples. While not a direct pip install dependency, practical use highly depends on it.","package":"numpy","optional":false}],"imports":[{"note":"The core library is imported directly as `embreex`.","symbol":"embreex","correct":"import embreex"},{"note":"Used for creating a ray intersector object.","symbol":"RayMeshIntersector","correct":"from embreex import RayMeshIntersector"},{"note":"Used for creating an Embree-compatible mesh from NumPy arrays.","symbol":"EmbreeTrimesh","correct":"from embreex import EmbreeTrimesh"}],"quickstart":{"code":"import embreex\nimport numpy as np\n\n# Define a simple mesh (e.g., a triangle)\nvertices = np.array([\n    [0.0, 0.0, 0.0],\n    [1.0, 0.0, 0.0],\n    [0.0, 1.0, 0.0]\n], dtype=np.float32)\nfaces = np.array([\n   \n], dtype=np.int32)\n\n# Create an Embree mesh object\nmesh = embreex.EmbreeTrimesh(vertices, faces)\n\n# Create a ray intersector from the mesh\nintersector = embreex.RayMeshIntersector(mesh)\n\n# Define a single ray (origin and direction)\nray_origins = np.array([[0.1, 0.1, 1.0]], dtype=np.float32)\nray_directions = np.array([[0.0, 0.0, -1.0]], dtype=np.float32)\n\n# Check if the ray hits the mesh\nhits = intersector.intersects_any(ray_origins, ray_directions)\nprint(f\"Ray hits mesh: {hits}\")\n\n# Find the first hit location and triangle index\nindex_tri, u, v, t = intersector.intersects_first(ray_origins, ray_directions)\nif index_tri != -1:\n    print(f\"\\nFirst hit details:\")\n    print(f\"  Hit triangle index: {index_tri}\")\n    print(f\"  Barycentric coordinates (U, V): {u:.4f}, {v:.4f}\")\n    print(f\"  Distance along ray (t): {t:.4f}\")\nelse:\n    print(\"\\nNo hit found for the ray.\")","lang":"python","description":"This quickstart demonstrates how to create a basic triangular mesh, initialize an `EmbreeTrimesh` object, create a `RayMeshIntersector`, and perform a ray-mesh intersection query to check for hits and retrieve hit details."},"warnings":[{"fix":"Review the `4.x` changelog and documentation (once stable) for migration instructions before upgrading.","message":"A new major version `4.x` is in release candidate stage (`4.4.0rc0`). Future stable releases in this series may introduce breaking API changes compared to the current stable `2.x` series.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Refer to the `embreex` GitHub repository README for details on its relationship to other forks and ensure your code aligns with the `embreex` API.","message":"Embreex is a fork of `scopatz/pyembree` with a name change to avoid confusion. While aiming for compatibility, users migrating from `pyembree` or other Embree Python bindings might encounter subtle API differences or behavioral changes.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your environment meets the pre-built wheel requirements (OS, Python version). If compilation is necessary, consult the `trimesh/embreex` GitHub repository for build instructions and dependencies.","message":"The library primarily provides pre-built wheels for easy installation on supported platforms (Windows, Linux, macOS) and Python versions (>=3.8). Installing on unsupported platforms, older Python versions (e.g., 3.6, 3.7 as mentioned in old documentation), or from source may require manual compilation of the underlying Intel Embree C++ library, which can be complex.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}