![]() |
Path Tracing
|
Path Tracer Core Shader. More...

Go to the source code of this file.
Functions | |
| void | camera_axes (out vec3 cam_x, out vec3 cam_y, out vec3 cam_z) |
| Calculates the base of the camera in world-space. | |
| vec3 | cameraRay (vec2 uv, vec3 cam_x, vec3 cam_y, vec3 cam_z, float fov_scale) |
| float | polygonAperture (float angle, int blades) |
| Max radius of a regular N-gon at a given angle. | |
| vec3 | sampleAperture (vec3 cam_x, vec3 cam_y, vec2 uv, float angle, float radius_rand) |
| Samples a point on the camera's aperture (lens disk) Shaped by CAM_APERTURE_BLADES/CAM_BLADE_ROTATION/CAM_ANAMORPHIC_SQUEEZE, and is biased towards the frame edges (behaviour like mechanical vignette) by CAM_CATEYE_STRENGTH. | |
| vec3 | focalPlanePoint (vec3 cam_x, vec3 cam_y, vec3 cam_z, vec3 ray_dir, float focal_distance) |
| Point on the (maybe tilted) focal plane that a given ray focuses on. | |
| Ray | cameraRayDOFChannel (vec2 uv, int spp_index, uvec2 px, float disp_coeff) |
| Creates a ray with depth of field, using one channel's lens parameters. | |
| Ray | cameraRayDOF (vec2 uv, int spp_index, uvec2 px) |
| Creates a ray with depth of field. | |
| vec3 | sampleEnvMap (vec3 dir) |
| float | rayEps () |
| Scene-relative epsilon for ray origins, avoids self-intersection. | |
| vec3 | surfaceOrigin (Hit h) |
| Origin for any ray leaving an opaque surface on the side it was hit from (diffuse/mirror bounces and every NEE shadow ray). Replaces old hardcoded fixed EPS Lifted off the flat triangle (shadow terminator) and pushed along the geometric normal. | |
| vec3 | sampleAnalyticLight (Hit h, int bounce, int spp_index, uvec2 px) |
| vec3 | sampleEmissiveTriangles (Hit h, int bounce, int spp_index, uvec2 px) |
| vec3 | sampleEnvLight (Hit h, int bounce, int spp_index, uvec2 px) |
| vec4 | pathTraceDebug (vec2 uv, int spp_index, uvec2 px) |
| vec4 | pathTraceFromRay (Ray ray, int spp_index, uvec2 px, float disp_coeff) |
| Traces a single already-generated path through the bounce loop and returns the radiance. Extracted from pathTrace() so the exact same bounce logic can be called per color channel, hero-sampling style. | |
| vec4 | pathTrace (vec2 uv, int spp_index, uvec2 px) |
Path Tracer Core Shader.
| void camera_axes | ( | out vec3 | cam_x, |
| out vec3 | cam_y, | ||
| out vec3 | cam_z ) |
Calculates the base of the camera in world-space.
| vec3 | All camera axes |
| vec3 cameraRay | ( | vec2 | uv, |
| vec3 | cam_x, | ||
| vec3 | cam_y, | ||
| vec3 | cam_z, | ||
| float | fov_scale ) |
Calculates the direction of a ray for a pixel
| uv | Pixel coordinates |
| vec3 | All camera axes |
| fov_scale | Multiplier on CAM_FOV, so callers can perturb it per color/colour channel |
| Ray cameraRayDOF | ( | vec2 | uv, |
| int | spp_index, | ||
| uvec2 | px ) |
Creates a ray with depth of field.
| uv | pixel coordinates [0,1] |
| Ray cameraRayDOFChannel | ( | vec2 | uv, |
| int | spp_index, | ||
| uvec2 | px, | ||
| float | disp_coeff ) |
Creates a ray with depth of field, using one channel's lens parameters.
| vec3 focalPlanePoint | ( | vec3 | cam_x, |
| vec3 | cam_y, | ||
| vec3 | cam_z, | ||
| vec3 | ray_dir, | ||
| float | focal_distance ) |
Point on the (maybe tilted) focal plane that a given ray focuses on.
| vec4 pathTrace | ( | vec2 | uv, |
| int | spp_index, | ||
| uvec2 | px ) |
| vec4 pathTraceDebug | ( | vec2 | uv, |
| int | spp_index, | ||
| uvec2 | px ) |
Used to debug the brute-force path tracer for only the primary ray, no bounces, no materials, no optimizations, no NEE
| vec4 pathTraceFromRay | ( | Ray | ray, |
| int | spp_index, | ||
| uvec2 | px, | ||
| float | disp_coeff ) |
Traces a single already-generated path through the bounce loop and returns the radiance. Extracted from pathTrace() so the exact same bounce logic can be called per color channel, hero-sampling style.
| channel | to which this ray is dedicated to (0=R, 1=G, 2=B), for MAT_GLASS |
PDF of the direction the BSDF sampler chose at the previous vertex. < 0 == no valid competing NEE strategy Means that emission hit directly so it gets full weight instead of MIS-weighted
DEPRECATED
| float polygonAperture | ( | float | angle, |
| int | blades ) |
Max radius of a regular N-gon at a given angle.
| blades | number of aperture blades, <3 returns 1.0 (circular) |
| float rayEps | ( | ) |
Scene-relative epsilon for ray origins, avoids self-intersection.
| vec3 sampleAnalyticLight | ( | Hit | h, |
| int | bounce, | ||
| int | spp_index, | ||
| uvec2 | px ) |
Adaptive EPS for shadow rays to avoid self-intersection
MIS only applies where a BSDF sampled ray could land here Like a directional light with real angular extent. Delta light (point, spot, 0-radius sun) get full weight
| vec3 sampleAperture | ( | vec3 | cam_x, |
| vec3 | cam_y, | ||
| vec2 | uv, | ||
| float | angle, | ||
| float | radius_rand ) |
Samples a point on the camera's aperture (lens disk) Shaped by CAM_APERTURE_BLADES/CAM_BLADE_ROTATION/CAM_ANAMORPHIC_SQUEEZE, and is biased towards the frame edges (behaviour like mechanical vignette) by CAM_CATEYE_STRENGTH.
| uv | pixel coordinates [0,1], used only for cat's-eye |
| angle | random angle around the lens |
| radius_rand | random [0,1[ for the radius, distributed in uniform disk density using the sqrt |
| vec3 sampleEmissiveTriangles | ( | Hit | h, |
| int | bounce, | ||
| int | spp_index, | ||
| uvec2 | px ) |
Adaptive EPS for shadow rays to avoid self-intersection
| vec3 sampleEnvLight | ( | Hit | h, |
| int | bounce, | ||
| int | spp_index, | ||
| uvec2 | px ) |
| vec3 sampleEnvMap | ( | vec3 | dir | ) |
| vec3 surfaceOrigin | ( | Hit | h | ) |
Origin for any ray leaving an opaque surface on the side it was hit from (diffuse/mirror bounces and every NEE shadow ray). Replaces old hardcoded fixed EPS Lifted off the flat triangle (shadow terminator) and pushed along the geometric normal.