16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 12:49:18 +02:00

support rain shader in experimental

This commit is contained in:
Wls50
2025-11-22 17:06:06 +01:00
committed by Hirek
parent ac62f23f0f
commit 915e4c769e
7 changed files with 270 additions and 12 deletions

View File

@@ -0,0 +1,39 @@
uint Hash(uint s);
uint Hash(uint2 s);
uint Hash(uint3 s);
uint Hash(float s);
uint HashCombine(uint seed, uint value);
// Evolving Sub-Grid Turbulence for Smoke Animation
// H. Schechter and R. Bridson
uint Hash(uint s) {
s ^= 2747636419u;
s *= 2654435769u;
s ^= s >> 16u;
s *= 2654435769u;
s ^= s >> 16u;
s *= 2654435769u;
return s;
}
uint Hash(uint2 s) {
return HashCombine(Hash(s.x), s.y);
}
uint Hash(uint3 s) {
return HashCombine(Hash(s.xy), s.z);
}
uint HashCombine(uint seed, uint value) {
return seed ^ (Hash(value) + 0x9e3779b9u + (seed<<6u) + (seed>>2u));
}
uint Rand(inout uint seed) {
seed = Hash(seed);
return seed;
}
float RandF(inout uint seed) {
return float(Rand(seed)) * 2.3283064365386963e-10;
}

View File

@@ -8,6 +8,10 @@ cbuffer DrawConstants : register(b2) {
float g_Altitude;
float3 g_LightColor;
float g_Time;
float4 g_RainParams;
float4 g_WiperPos;
float4 g_WiperTimerOut;
float4 g_WiperTimerReturn;
}
float2 PixelToCS(in float2 pixel, in float2 size) {