![]() |
Path Tracing
|

Go to the source code of this file.
Functions | |
| float | planeT (Ray ray, vec3 normal, float offset) |
| float | planeT_Z (Ray ray, float offset) |
| float | planeT_X (Ray ray, float offset) |
| Specific X-axis plane, with only offset. | |
| float | planeT_Y (Ray ray, float offset) |
| Specific Y-axis plane, with only offset. | |
| float | sphereT (Ray ray, vec3 center, float radius) |
| float | boxT (Ray ray, vec3 center, vec3 half_size, float pitch, float yaw, out vec3 out_normal) |
| float | boxTAxisAligned (Ray ray, vec3 center, vec3 half_size, out vec3 out_normal) |
| Fast axis-aligned box intersect, same result as boxT, but skips unused math Skips OBB rotation match, used for BVH traversal, which never rotates. | |
| float | triangleT (Ray ray, vec3 v0, vec3 v1, vec3 v2, out vec3 out_normal, out vec3 out_bary) |
| float | triangleT (Ray ray, vec3 v0, vec3 v1, vec3 v2, out vec3 out_normal) |
| vec3 | terminatorLift (vec3 p, vec3 a, vec3 b, vec3 c, vec3 na, vec3 nb, vec3 nc, vec3 w) |
| Shadow terminator lifts a hit from the flat triangle onto the smooth surface implied by the vertex normals. p is projected onto each vertex's tangent plane it lies under (convex areas only) and the projections are blended with the barycentrics. | |
| float boxT | ( | Ray | ray, |
| vec3 | center, | ||
| vec3 | half_size, | ||
| float | pitch, | ||
| float | yaw, | ||
| out vec3 | out_normal ) |
AABBIntersect from https://alelievr.github.io/Modern-Rendering-Introduction/AABBIntersection/
Also based on knightcrawler25's GLSL-PATHTRACER. But applied OBB for rotation. Rotation is calculated from pitch and yaw for simplification
| float boxTAxisAligned | ( | Ray | ray, |
| vec3 | center, | ||
| vec3 | half_size, | ||
| out vec3 | out_normal ) |
| float planeT | ( | Ray | ray, |
| vec3 | normal, | ||
| float | offset ) |
General plane function using normal vector to give facing direction
| float planeT_X | ( | Ray | ray, |
| float | offset ) |
Specific X-axis plane, with only offset.
| float planeT_Y | ( | Ray | ray, |
| float | offset ) |
Specific Y-axis plane, with only offset.
| float planeT_Z | ( | Ray | ray, |
| float | offset ) |
Specific Z-axis plane, with only offset
| float sphereT | ( | Ray | ray, |
| vec3 | center, | ||
| float | radius ) |
Interseção raio-esfera ||o + t·v - c||² = r² Expande para t²(v·v) + 2t(v·(o-c)) + (||o-c||² - r²) = 0 Onde o = ray_origin v = ray_dir c = center r = radius Solução t = (-b ±sqrt(b² - 4ac)) / (2a) Em que coeficientes são a = v·v b = 2v·(o - c) c = ||o - c||² - r² Simplificado para b' = v·(o - c) → float b t = -b' ±sqrt(b'² - c) → float t Assumindo que ray.direction está normalizado v·v=1 → a=1
| vec3 terminatorLift | ( | vec3 | p, |
| vec3 | a, | ||
| vec3 | b, | ||
| vec3 | c, | ||
| vec3 | na, | ||
| vec3 | nb, | ||
| vec3 | nc, | ||
| vec3 | w ) |
Shadow terminator lifts a hit from the flat triangle onto the smooth surface implied by the vertex normals. p is projected onto each vertex's tangent plane it lies under (convex areas only) and the projections are blended with the barycentrics.
| w | barycentric weights matching a, b, c |
| na,nb,nc | vertex normals, on the same side as the geometric normal |
| float triangleT | ( | Ray | ray, |
| vec3 | v0, | ||
| vec3 | v1, | ||
| vec3 | v2, | ||
| out vec3 | out_normal ) |
| float triangleT | ( | Ray | ray, |
| vec3 | v0, | ||
| vec3 | v1, | ||
| vec3 | v2, | ||
| out vec3 | out_normal, | ||
| out vec3 | out_bary ) |
Möller-Trumbore ray-triangle intersect.