- Bluenoise in the game INSIDE (dithering, raymarching, reflections)
- Dithering, Ray marching, shadows etc
- A Survery of Blue Noise and Its Applications
- Moments In Graphics (void-and-cluster)
- Bart Wronski Implementation of Solid Angle algorithm
| // Helper function: sample the visible hemisphere from a spherical cap | |
| vec3 SampleVndf_Hemisphere(vec2 u, vec3 wi) | |
| { | |
| // sample a spherical cap in (-wi.z, 1] | |
| float phi = 2.0f * M_PI * u.x; | |
| float z = fma((1.0f - u.y), (1.0f + wi.z), -wi.z); | |
| float sinTheta = sqrt(clamp(1.0f - z * z, 0.0f, 1.0f)); | |
| float x = sinTheta * cos(phi); | |
| float y = sinTheta * sin(phi); | |
| vec3 c = vec3(x, y, z); |
| struct Object { | |
| Key key; // The key is any piece of data that uniquely identifies the object. | |
| // ... | |
| }; | |
| struct Handle { | |
| Key key; | |
| Index index; // This caches a speculative table index for an object with the corresponding key. | |
| }; |
| #pragma use_dxc //enable SM 6.0 features, in Unity this is only supported on version 2020.2.0a8 or later with D3D12 enabled | |
| #pragma kernel CountTotalsInBlock | |
| #pragma kernel BlockCountPostfixSum | |
| #pragma kernel CalculateOffsetsForEachKey | |
| #pragma kernel FinalSort | |
| uint _FirstBitToSort; | |
| int _NumElements; | |
| int _NumBlocks; | |
| bool _ShouldSortPayload; |
| // Projects the specified position (point) onto the plane with the specified origin and normal. | |
| float3 projectOnPlane(float3 position, float3 origin, float3 normal) | |
| { | |
| return position - dot(position - origin, normal) * normal; | |
| } | |
| // Computes the shading position of the specified geometric position and vertex positions and | |
| // normals. For a triangle with normals describing a convex surface, this point will be slightly | |
| // above the surface. For a concave surface, the geometry position is used directly. | |
| // NOTE: The difference between the shading position and geometry position is significant when |
| #include <stdio.h> | |
| // #define CLANG_EXTENSION | |
| // Clang compile with -O3 | |
| #define VS_EXTENSION | |
| // https://godbolt.org/z/sVWrF4 | |
| // Clang compile with -O3 -fms-compatibility | |
| // VS2017 compile with /O3 |