|
Untitled
|
Go to the source code of this file.
Data Structures | |
| struct | Light |
| The CPU side structure for Lights. More... | |
| struct | Material |
| The Materials parsed in from scene files that determine rendering pipeline setup, uploads, and ordering. More... | |
| struct | Vertex |
| struct | Face |
| struct | MeshNode |
| MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to other MeshNodes. More... | |
| struct | AABB |
| struct | BVHNode |
| Nodes for the acceleration structures of BVHs. More... | |
| struct | RayHit |
Macros | |
| #define | MINIMUM_LIGHT_VISIBILITY_DIST 0.1 |
Functions | |
| layout (local_size_x=16, local_size_y=16, local_size_z=1) in | |
| layout (rgba32f, binding=0) uniform image2D lightmapTex | |
| layout (std430, binding=0) buffer LightData | |
| uint | pcg_hash () |
| uint | wang_hash (uint seed) |
| float | rand () |
| void | frisvad_basis (in vec3 n, out vec3 b1, out vec3 b2) |
| vec3 | get_bounce_direction (vec3 normal) |
| bool | ray_intersects_triangle (vec3 origin, vec3 dir, vec3 a, vec3 b, vec3 c, out RayHit out_hit) |
| bool | slab_test (in BVHNode n, vec3 pos, vec3 inv_dir) |
| vec2 | get_hit_uvs (in Face tri, in RayHit hit) |
| vec4 | get_hit_albedo (in Material mat, vec2 hit_uv) |
| float | get_hit_metallic (in Material mat, vec2 hit_uv) |
| vec3 | get_hit_emissive (in Material mat, vec2 hit_uv) |
| void | traverse_mesh_bvh (uint node_offset, uint mn_id, vec3 pp, vec3 pm, vec3 original_dir, vec3 dir, vec3 md, uint mesh, uint tri) |
| void | traverse_scene_bvh (vec3 pp, vec3 dir, vec3 inv_dir, uint light_type, uint mesh, uint tri) |
| vec3 | compute_3d_barycentric (vec3 a, vec3 b, vec3 c, vec3 p) |
| vec2 | get_uvs (vec3 B, uint tri_idx) |
| float | CalculateAttenuation (float distance, float radius, float intensity) |
| vec3 | solve_light_source (in Light l, vec3 pos, vec3 normal, uint mesh, uint tri) |
| vec3 | random_pos_on_triangle (vec3 a, vec3 b, vec3 c) |
| vec3 | process_area_light (in Light light, vec3 pos, vec3 normal, vec3 brdf, float p_select) |
| vec3 | process_light (vec3 pos, vec3 normal, uint mesh, uint tri, vec3 brdf, Light light, float p_select) |
| vec3 | closest_point_on_aabb (vec3 pos, vec3 min, vec3 max) |
| bool | pos_inside_aabb (vec3 pos, vec3 min, vec3 max) |
| vec3 | traverse_light_bvh (vec3 pos, vec3 normal, uint mesh, uint tri, vec3 brdf) |
| vec3 | traverse_light_bvh_direct_emissives (vec3 pos, vec3 normal, vec3 brdf) |
| vec3 | resolve_transparents (vec3 throughput, vec3 pos, vec3 dir, vec3 inv_dir) |
| vec3 | trace_path (vec3 pos, vec3 normal, ivec3 ids) |
| void | main () |
Variables | |
| uniform sampler2D | uLightmapPosTex |
| uniform sampler2D | uLightmapNormalTex |
| uniform isampler2D | uLightmapIDTex |
| uniform samplerCube | uSkybox |
| uniform ivec2 | uTileOffset |
| uniform int | uLightCount |
| uniform int | uIteration |
| uniform int | uLightmapWidth |
| uniform int | uLightmapHeight |
| uint | state = 0 |
| RayHit | hit |
| vec3 | first_bounce_dir |
| int | ao_hits |
| uniform int | uAOIterations |
| uniform float | uAOThreshold |
| struct Vertex |
Definition at line 49 of file audio_probe_bake.comp.
| Data Fields | ||
|---|---|---|
| vec3 | pos | |
| uint | pad0 | |
| vec3 | normal | |
| uint | pad1 | |
| vec2 | uv | |
| uint | pad2 | |
| uint | pad3 | |
| struct Face |
| struct AABB |
| struct BVHNode |
Nodes for the acceleration structures of BVHs.
Definition at line 125 of file audio_probe_bake.comp.
| Data Fields | ||
|---|---|---|
| int | left |
Left child. -1 if empty. |
| int | right |
Right child. -1 if empty. |
| int | parent |
Parent. -1 if empty. |
| int | index | The index of the node inside of the array. |
| int | first_index | |
| int | count | |
| int | next |
The pointer to the next node (either right child or parent's right child) for recursion-less traversal. See: assign_next_nodes(). |
| uint | pad0 | |
| vec3 | min | |
| uint | pad1 | |
| vec3 | max | |
| uint | pad2 | |
| vec3 | center | |
| uint | pad3 | |
| vec3 | extents | |
| uint | pad4 | |
| AABB | aabb | The bounding box of all of this node's children. |
| size_t | first_index | The first index into the bvh_indices array. |
| size_t | count | How many children are inside this node. |
| float | flux |
The total light flux of this node. Used for Light BVH importance sampling. |
| float | emissive_flux |
The only-emissive flux. Used for Light BVH importance sampling. |
| struct RayHit |
| #define MINIMUM_LIGHT_VISIBILITY_DIST 0.1 |
Definition at line 256 of file lightmap_bounce.comp.
| layout | ( | local_size_x | = 16, |
| local_size_y | = 16, | ||
| local_size_z | = 1 ) |
References layout().
| layout | ( | rgba32f | , |
| binding | = 0 ) |
References layout().
| layout | ( | std430 | , |
| binding | = 0 ) |
Definition at line 39 of file lightmap_bounce.comp.
References layout().
| uint pcg_hash | ( | ) |
Definition at line 278 of file lightmap_bounce.comp.
References pcg_hash(), and state.
| uint wang_hash | ( | uint | seed | ) |
Definition at line 285 of file lightmap_bounce.comp.
References wang_hash().
| float rand | ( | ) |
Definition at line 293 of file lightmap_bounce.comp.
References pcg_hash(), and rand().
Definition at line 320 of file lightmap_bounce.comp.
References frisvad_basis(), and n.
Definition at line 339 of file lightmap_bounce.comp.
References frisvad_basis(), get_bounce_direction(), rand(), TBN, and vec3::z.
Definition at line 403 of file lightmap_bounce.comp.
References RayHit::hit, and ray_intersects_triangle().
Definition at line 445 of file lightmap_bounce.comp.
References hit, n, slab_test(), RayHit::t, vec3::x, vec3::y, and vec3::z.
Definition at line 462 of file lightmap_bounce.comp.
References RayHit::barycentrics, get_hit_uvs(), hit, vec3::x, vec3::y, and vec3::z.
Referenced by get_hit_uvs(), process_area_light(), process_area_light(), resolve_transparents(), solve_light_source(), solve_light_source(), trace_path(), trace_path(), and traverse_mesh_bvh().
Definition at line 479 of file lightmap_bounce.comp.
References get_hit_albedo().
Referenced by get_hit_albedo(), process_area_light(), process_area_light(), resolve_transparents(), solve_light_source(), solve_light_source(), trace_path(), trace_path(), and traverse_mesh_bvh().
Definition at line 486 of file lightmap_bounce.comp.
References get_hit_metallic().
Referenced by get_hit_metallic().
Definition at line 493 of file lightmap_bounce.comp.
References get_hit_emissive().
Referenced by get_hit_emissive(), process_area_light(), process_area_light(), trace_path(), and trace_path().
| void traverse_mesh_bvh | ( | uint | node_offset, |
| uint | mn_id, | ||
| vec3 | pp, | ||
| vec3 | pm, | ||
| vec3 | original_dir, | ||
| vec3 | dir, | ||
| vec3 | md, | ||
| uint | mesh, | ||
| uint | tri ) |
Definition at line 499 of file lightmap_bounce.comp.
References RayHit::best_t, RayHit::blocked_t, get_hit_albedo(), get_hit_uvs(), hit, RayHit::hit, Face::material_id, RayHit::mn_idx, n, Face::normal, RayHit::normal, RayHit::occluded, Vertex::pos, ray_intersects_triangle(), slab_test(), RayHit::t, traverse_mesh_bvh(), RayHit::tri_idx, Face::v0, Face::v1, and Face::v2.
Definition at line 593 of file lightmap_bounce.comp.
References MeshNode::inverse_global_matrix, MeshNode::is_static, MeshNode::mesh_id, MeshNode::mesh_node_id, n, MeshNode::node_offset, slab_test(), traverse_mesh_bvh(), and traverse_scene_bvh().
Definition at line 644 of file lightmap_bounce.comp.
References compute_3d_barycentric().
Referenced by compute_3d_barycentric(), compute_3d_barycentric(), compute_hull_centroid(), epa(), process_area_light(), process_area_light(), and trace_path().
Definition at line 660 of file lightmap_bounce.comp.
References B, get_uvs(), Vertex::uv, Face::v0, Face::v1, Face::v2, vec3::x, vec3::y, and vec3::z.
Referenced by get_uvs(), process_area_light(), process_area_light(), and trace_path().
| float CalculateAttenuation | ( | float | distance, |
| float | radius, | ||
| float | intensity ) |
Definition at line 676 of file lightmap_bounce.comp.
References CalculateAttenuation(), clamp(), and window.
Referenced by CalculateAttenuation(), solve_light_source(), and solve_light_source().
Definition at line 686 of file lightmap_bounce.comp.
References RayHit::best_t, RayHit::blocked_t, CalculateAttenuation(), clamp(), get_hit_albedo(), get_hit_uvs(), hit, RayHit::hit, MeshNode::inverse_global_matrix, Face::material_id, RayHit::mn_idx, Face::normal, RayHit::normal, RayHit::occluded, RayHit::pos, solve_light_source(), RayHit::t, traverse_scene_bvh(), and RayHit::tri_idx.
Referenced by process_light(), solve_light_source(), solve_light_source(), and traverse_light_bvh().
Definition at line 833 of file lightmap_bounce.comp.
References rand(), and random_pos_on_triangle().
Referenced by process_area_light(), process_area_light(), and random_pos_on_triangle().
Definition at line 844 of file lightmap_bounce.comp.
References A, B, RayHit::best_t, RayHit::blocked_t, C, color, compute_3d_barycentric(), get_hit_albedo(), get_hit_emissive(), get_hit_uvs(), get_uvs(), MeshNode::global_matrix, hit, RayHit::hit, MeshNode::inverse_global_matrix, Face::material_id, RayHit::mn_idx, Face::normal, RayHit::normal, RayHit::occluded, RayHit::pos, Vertex::pos, process_area_light(), random_pos_on_triangle(), RayHit::t, traverse_scene_bvh(), RayHit::tri_idx, MeshNode::tri_offset, Face::v0, Face::v1, and Face::v2.
Referenced by process_area_light(), process_area_light(), process_light(), and traverse_light_bvh_direct_emissives().
| vec3 process_light | ( | vec3 | pos, |
| vec3 | normal, | ||
| uint | mesh, | ||
| uint | tri, | ||
| vec3 | brdf, | ||
| Light | light, | ||
| float | p_select ) |
Definition at line 970 of file lightmap_bounce.comp.
References Light::light_type, process_area_light(), process_light(), and solve_light_source().
Referenced by process_light(), and traverse_light_bvh().
Definition at line 1002 of file lightmap_bounce.comp.
References clamp(), and closest_point_on_aabb().
Referenced by closest_point_on_aabb(), traverse_light_bvh(), and traverse_light_bvh_direct_emissives().
Definition at line 1007 of file lightmap_bounce.comp.
References pos_inside_aabb(), vec3::x, vec3::y, and vec3::z.
Referenced by pos_inside_aabb().
Definition at line 1015 of file lightmap_bounce.comp.
References closest_point_on_aabb(), color, Light::color, BVHNode::flux, Light::intensity, BVHNode::max, BVHNode::min, n, process_light(), rand(), solve_light_source(), traverse_light_bvh(), and uLightCount.
Referenced by trace_path(), trace_path(), and traverse_light_bvh().
Definition at line 1191 of file lightmap_bounce.comp.
References closest_point_on_aabb(), color, BVHNode::emissive_flux, Light::light_type, BVHNode::max, BVHNode::min, n, process_area_light(), rand(), and traverse_light_bvh_direct_emissives().
Referenced by trace_path(), trace_path(), and traverse_light_bvh_direct_emissives().
Definition at line 1277 of file lightmap_bounce.comp.
References RayHit::best_t, RayHit::blocked_t, get_hit_albedo(), get_hit_uvs(), hit, RayHit::hit, MeshNode::inverse_global_matrix, Face::material_id, RayHit::mn_idx, Face::normal, RayHit::normal, RayHit::occluded, RayHit::pos, rand(), resolve_transparents(), RayHit::t, traverse_scene_bvh(), and RayHit::tri_idx.
Referenced by resolve_transparents(), trace_path(), and trace_path().
Definition at line 1342 of file lightmap_bounce.comp.
References A, ao_hits, B, RayHit::best_t, RayHit::blocked_t, C, compute_3d_barycentric(), first_bounce_dir, get_bounce_direction(), get_hit_albedo(), get_hit_emissive(), get_hit_uvs(), get_uvs(), MeshNode::global_matrix, hit, RayHit::hit, MeshNode::inverse_global_matrix, Face::material_id, RayHit::mn_idx, Face::normal, RayHit::normal, RayHit::occluded, RayHit::pos, Vertex::pos, resolve_transparents(), RayHit::t, trace_path(), traverse_light_bvh(), traverse_light_bvh_direct_emissives(), traverse_scene_bvh(), RayHit::tri_idx, MeshNode::tri_offset, uAOIterations, uAOThreshold, uSkybox, Face::v0, Face::v1, Face::v2, vec3::x, ivec3::y, vec3::y, ivec3::z, and vec3::z.
Referenced by main(), trace_path(), and trace_path().
| void main | ( | ) |
Definition at line 1598 of file lightmap_bounce.comp.
References ao_hits, first_bounce_dir, main(), state, trace_path(), uAOIterations, uIteration, uLightmapHeight, uLightmapIDTex, uLightmapNormalTex, uLightmapPosTex, uLightmapWidth, uTileOffset, uv, vec4::w, wang_hash(), ivec2::x, ivec2::y, and ivec3::y.
| uniform sampler2D uLightmapPosTex |
Definition at line 243 of file lightmap_bounce.comp.
Referenced by main().
| uniform sampler2D uLightmapNormalTex |
Definition at line 244 of file lightmap_bounce.comp.
Referenced by main().
| uniform isampler2D uLightmapIDTex |
Definition at line 245 of file lightmap_bounce.comp.
Referenced by main().
| uniform samplerCube uSkybox |
Definition at line 246 of file lightmap_bounce.comp.
Referenced by trace_path(), and trace_path().
| uniform ivec2 uTileOffset |
Definition at line 248 of file lightmap_bounce.comp.
Referenced by main().
| uniform int uLightCount |
Definition at line 249 of file lightmap_bounce.comp.
Referenced by main(), and traverse_light_bvh().
| uniform int uIteration |
Definition at line 250 of file lightmap_bounce.comp.
Referenced by main().
| uniform int uLightmapWidth |
Definition at line 251 of file lightmap_bounce.comp.
| uniform int uLightmapHeight |
Definition at line 252 of file lightmap_bounce.comp.
| uint state = 0 |
Definition at line 276 of file lightmap_bounce.comp.
| RayHit hit |
Definition at line 401 of file lightmap_bounce.comp.
| vec3 first_bounce_dir |
Definition at line 1335 of file lightmap_bounce.comp.
Referenced by main(), and trace_path().
| int ao_hits |
Definition at line 1338 of file lightmap_bounce.comp.
Referenced by main(), and trace_path().
| uniform int uAOIterations |
Definition at line 1340 of file lightmap_bounce.comp.
Referenced by main(), and trace_path().
| uniform float uAOThreshold |
Definition at line 1341 of file lightmap_bounce.comp.
Referenced by trace_path().