Skip to content

Instantly share code, notes, and snippets.

View hyblocker's full-sized avatar
💭
make epic shadur

Hyblocker hyblocker

💭
make epic shadur
View GitHub Profile
@pema99
pema99 / ZH3.cginc
Created May 31, 2024 01:12
ZH3 - Quadratic Zonal Harmonics, i3D 2024 - Unity shadercode
// Paper: ZH3: Quadratic Zonal Harmonics, i3D 2024. https://torust.me/ZH3.pdf
// Code based on paper and demo https://www.shadertoy.com/view/Xfj3RK
#include "UnityCG.cginc"
// L1 radiance = L1 irradiance * PI / Y_1 / AHat_1
// PI / (sqrt(3 / PI) / 2) / ((2 * PI) / 3) = sqrt(3 * PI)
const static float L0IrradianceToRadiance = 2 * sqrt(UNITY_PI);
// L0 radiance = L0 irradiance * PI / Y_0 / AHat_0
@pema99
pema99 / QuadIntrinsics.cginc
Last active July 3, 2024 09:48
Emulated Quad and Wave intrinsics for basic fragment shaders
// SPDX-License-Identifier: MIT
// Author: pema99
// This file contains functions that simulate Quad and Wave Intrinsics without access to either.
// For more information on those, see: https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics
// To use the functions, you must call SETUP_QUAD_INTRINSICS(pos) at the start of your fragment shader,
// where 'pos' is the pixel position, ie. the fragment input variable with the SV_Position semantic.
// Note that some functions will require SM 5.0, ie. #pragma target 5.0.