diff options
| author | yum <yum.food.vr@gmail.com> | 2025-02-26 01:18:09 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-02-26 01:18:19 -0800 |
| commit | 0264f5e767b0b54e82b7c11457b491be555be577 (patch) | |
| tree | 4a31a90956b167c959eb8f45328719384a19ac89 /math.cginc | |
| parent | 6017d2d8bad7dde020121259cba5cb614c11f761 (diff) | |
Add glitter and more masked stencil channels
Diffstat (limited to 'math.cginc')
| -rw-r--r-- | math.cginc | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -5,7 +5,9 @@ #define PI 3.14159265358979323846264
#define TAU (2 * PI)
+#define HALF_PI (PI * 0.5)
#define PHI 1.618033989
+#define SQRT_2_RCP 0.707106781
float pow5(float x)
{
@@ -175,6 +177,13 @@ void domainWarp3Normals(inout float3 normal, inout float3 tangent, float3 basePo tangent = normalize(mul(J, tangent));
}
+// Alpha blend `dst` onto `src`.
+// Imagine two transparent planes. We're rendering a situation where you're
+// looking through `front` at `behind`.
+float4 alphaBlend(float4 behind, float4 front) {
+ return float4(front.rgb * front.a + behind.rgb * (1 - front.a), front.a + behind.a * (1 - front.a));
+}
+
#endif // __MATH_INC
|
