PathTracer
Light transport on trimmed NURBS geometry, in C++ with a Python package: light tracing, path tracing, bidirectional path tracing and photon mapping as estimators of the same quantities – the irradiance on faces (a texture per face) and the radiance seen by a camera.
It is the C++ twin of the NumPy kernel of the Path Tracer plugin of Raytatouille Fusion
(python/plugins/pathtracer/pt_*.py there): the same model and the same estimators, written one
path at a time instead of arrays of paths, and run on all processor cores. The plugin's guide
describes the model; this file describes the library.
What is in it
| Part | File | |
|---|---|---|
| NURBS | src/core.cpp |
curves and surfaces of the .nfcad format, points and first derivatives |
| Mesh | src/mesh.cpp |
every face tessellated in its surface parameters to a chordal tolerance; trimming as a mask over (u, v) tested at every hit; face and texel areas over the same mask; the exact surface normal where a ray meets a curved face (Newton) |
| BVH | src/bvh.cpp, header |
surface area heuristic; nearest hit and any hit with a filter |
| Materials | src/material.cpp |
absorber, diffuse (with transmission), mirror, glossy, glass, detector, metal and frosted (GGX); by wavelength: index (Abbe number), reflectance, absorption |
| Sources | src/scene.cpp, src/photometry.cpp |
surfaces (cone or a measured distribution), points, curves (thin wires); line spectra; luminaire files (IES LM-63, EULUMDAT) |
| Scene | src/scene.cpp |
closed bodies oriented by counting crossings; glass bodies that touch or lie inside one another |
| Sensors | src/sensor.cpp |
textures on faces, pinhole and lens camera; shares of the samples per texel / pixel that adapt |
| Estimators | src/integrator.cpp, src/photon.cpp |
subpaths, connections, multiple importance sampling; photon mapping; batches on threads, standard errors; the light that leaves the scene |
| Python | bindings/module.cpp, python/pathtracer |
geometry as .nfcad dicts in, NumPy arrays out |
Lengths in mm, power in W: radiance in W/(mm² sr), irradiance = flux per texel / texel area.
Install
pip install pathtracer # wheels for Linux x86_64, Windows AMD64, macOS arm64; CPython 3.10–3.13
Releases: a tag v<version> (the version of pyproject.toml and python/pathtracer/__init__.py)
builds the wheels and the sdist (.github/workflows/wheels.yml) and attaches them to a GitHub
release; Run workflow on the tag with pypi ticked uploads them to PyPI (Trusted Publishing,
environment pypi).
Build
Needs a C++20 compiler, CMake ≥ 3.25, Python ≥ 3.10 with NumPy and pybind11.
pip install . # the package pathtracer
# or, in the source tree (the module lands in python/pathtracer):
cmake -S . -B build -G Ninja -Dpybind11_DIR=$(python -m pybind11 --cmakedir)
cmake --build build
python tests/test_kernel.py
Use
import pathtracer as pt
mesh = pt.build_mesh(entities, 0.01) # dicts {"id", "geometry"}: surface, trimmed_surface, shell
scene = pt.Scene(mesh,
[{"name": "white", "kind": "diffuse", "reflectance": 0.8},
{"name": "glass", "kind": "glass", "ior": 1.5}],
entity_material=[0, 1], # one material number per entity
sources=[{"name": "lamp", "flux": 1.0, "points": [(0, 0, 50)]}],
closed=[1]) # entities that are closed bodies
sensor = pt.TexelSensor(scene, faces=[0], long_side=64)
out = pt.render(scene, sensor, "bidir", samples=1_000_000, depth=8, seed=1)
flux = out["values"] # W per texel; out["error"]: its standard error
image = pt.render(scene, pt.Camera((300, -300, 200), (0, 0, 0), (0, 0, 1), 40, 320, 240), "path",
samples=2_000_000, depth=8)["values"].reshape(240, 320)
render(scene, sensor, method, samples, depth, seed=0, threads=0, radius=0, adaptive=False, weights=None, batch=0, progress=None, cancelled=None) – methods light, path, bidir,
photon; threads 0: all cores; the result is the same for any number of threads up to rounding.
escapes(scene, n, depth, seed=0, index=0, threads=0, skip=[]) – the light that leaves the scene (a far
field, e.g. the luminous intensity of a luminaire): n light subpaths of up to depth segments;
for every one that leaves, its direction d, its flux (the fluxes of one call add up to the
escaping flux), its wavelength's channel, its number of surface events bounces (0: straight
from the source) and the entities of its first and last surface (-1: none) – first passes
over the entities in skip (the first surface that is not one of them: e.g. what the light of a
lamp meets after its bulb). Batches of one seed are independent by index; the result does not
depend on the number of threads.
Tests
tests/test_kernel.py (about 10 s): the closed forms and cross-checks of the plugin's test –
point source over a plane, closed diffuse box, glass plates (also absorbing, dispersing,
touching, immersed), detectors, wires, measured distributions, cameras with and without a lens,
photon mapping through glass, microfacet sampling against its evaluation, standard errors,
adaptive sampling, threads, cancel.
Licence and sources
MIT, see LICENSE. No third-party code is included; the package is built with pybind11 (BSD-3-Clause) and uses NumPy (BSD-3-Clause) at run time. The methods follow the literature:
- B-spline basis functions: Piegl, Tiller, The NURBS Book, algorithm A2.2
- ray–triangle intersection: Möller, Trumbore (1997)
- path space, bidirectional path tracing, multiple importance sampling: Veach (1997)
- microfacet reflection and refraction through rough surfaces: Walter, Marschner, Li, Torrance (2007); sampling the visible normals of GGX: Heitz (2018)
- progressive photon mapping with a shrinking radius: Knaus, Zwicker (2011)
- random numbers: xoshiro256++ and SplitMix64 (Blackman, Vigna; public domain)
- photopic luminous efficiency V(λ): CIE 1924
- luminaire files: IES LM-63 and EULUMDAT, read from their format descriptions
Not here (yet)
Sources and cameras inside glass; polarisation; coatings; volumes.
Metadata
Release files for pathtracer 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pathtracer-0.3.0.tar.gz | 63.5 kB | With provenance | Details for pathtracer-0.3.0.tar.gz |
Built distributions (wheels)
Total release size: 3.6 MB
Release files / pathtracer-0.3.0.tar.gz
| Download URL | pathtracer-0.3.0.tar.gz |
|---|---|
| Size | 63.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ff8c68978055eb0b5770d461f6bcafc83763b263de1e47d205c8bfe27a076ad
|
|
BLAKE2b-256 checksum How to use checksums |
d1be22f5f33b5b29c05850936bbe0464cb850b5de1f0492fb41877ad9f897838
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp313-cp313-win_amd64.whl
| Download URL | pathtracer-0.3.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 275.1 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ef50da5a6ad0047403a66fd526e2997bd5d53981a3095e72f67f27ab4f411b64
|
|
BLAKE2b-256 checksum How to use checksums |
7ab310d5044401d2654eb6570d2021063fc3da1ee0818b9ae102758e45f6318a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pathtracer-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 333.5 kB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a0eb8bd27ad8cd1f07d637c767e8a784584bf925a698b4fc63d04311d8150dd5
|
|
BLAKE2b-256 checksum How to use checksums |
f02f0c978be5e91f415adf92f4a0d01b47ac0e3c3ce27e690120709cfecf0a10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pathtracer-0.3.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 267.2 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5c46be4fc88c269d7520d90250bbfa9d704eed01d7670608f90f1024c2a4d249
|
|
BLAKE2b-256 checksum How to use checksums |
ec6b6adaa0e3477cdeffe2be9c04c637664d10102370ca0db3e53ac9a5a1a5e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp312-cp312-win_amd64.whl
| Download URL | pathtracer-0.3.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 275.1 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6a90aa581923f7aba11394a2fdb9e65411041e38b257e16a040722cb2c550442
|
|
BLAKE2b-256 checksum How to use checksums |
56d24732ae3d0dd9214fde0516416d6d51c51872c3a59ce809a7d2e489daa11f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pathtracer-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 333.5 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
42284b49596b85db677a2873db5222225e54041a8ec74f77e5b307f8071a2121
|
|
BLAKE2b-256 checksum How to use checksums |
6b3184b1190aaf96fd253086a125e3b1f489f93837c42f4b845b540086471e25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pathtracer-0.3.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 267.2 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3353ed61574f6dba08f5bd2b5e01fa4bf936299fae0ac26b7227e8ce01d1ca2e
|
|
BLAKE2b-256 checksum How to use checksums |
7b7017433dd3a7791842cd69aecb1e2e103db5c44571f24d27b89d26ad6d57a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp311-cp311-win_amd64.whl
| Download URL | pathtracer-0.3.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 273.6 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0922113f0c28be319c9bb43e37ca036e8a9ce5c675b8ca4a2648bbc2fde70a20
|
|
BLAKE2b-256 checksum How to use checksums |
6a403ecf575ec4032765dc50311e327f0276c93daaaed61b9cb8ef8d8a539644
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pathtracer-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 331.3 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
85c35f073fa8011e3c1e50670a49a6a6edee84e705d0bd5238e89b777e4c7878
|
|
BLAKE2b-256 checksum How to use checksums |
ab2222819a345fb369658edf09da944ca17c629a6e5d4a623d6f1be0498ad68a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pathtracer-0.3.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 265.1 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5da6f9eb73f005b4aa4ce84a8a576962e73a350f01df0596a65456886f37e4c0
|
|
BLAKE2b-256 checksum How to use checksums |
67ed023360e7a5a30ee1db3262a9987d567f1985acc9cafb373bbe12308bb3d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp310-cp310-win_amd64.whl
| Download URL | pathtracer-0.3.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 272.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b0e45dee8aeaac533e19cc067bc3c2336be04412342325ebaadfaa31352b1670
|
|
BLAKE2b-256 checksum How to use checksums |
ea276f9e42705c530d95e80a39e17498655e33f3d61e3af43211fd3d20baa08f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pathtracer-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 330.2 kB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1ed7a9d429cb0eff5ddc6b7d58a4be0be2002ddcf7fef7d059d52c2b1c193678
|
|
BLAKE2b-256 checksum How to use checksums |
168ccdcfa3265eaa7eed7356e81b6dc2b6078301ac958d95bfb3f3d2ace9c123
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pathtracer-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pathtracer-0.3.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 263.2 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e5310d07ff50c77a39fa24bdb34ae79d909d0797130c299ce0254173a1fdb2a6
|
|
BLAKE2b-256 checksum How to use checksums |
2b7d60a9c821498f9f18b9d18353f83277868982541c1a691d03a9f0fa39f41a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for pathtracer 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 13 files in this release have been uploaded with provenance metadata.
Attestation for pathtracer-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.