Added baseplate code for fog transition later

This commit is contained in:
patience 2026-04-21 13:59:09 +01:00
parent b5bf1c7c1a
commit 3439211cb1
No known key found for this signature in database

View file

@ -367,6 +367,60 @@ float4 doom(float2 st : TEXCOORD0) : COLOR0 {
return color;
}
/* NOTE: FBM is a bit heavier than other tasks, so this will have to wait until I'm doing ps_3_0 things.
float fract(float x){return x-floor(x);}
float mix(float x, float y, float a){return x*(1.-a)+y*a;}
// This FBM functionality from thebookofshaders.com, unfortunately I don't have time to design my own version currently.
float random (in float2 st) {
return fract(sin(dot(
st.xy,
float2(12.9898,78.233)
))*43758.5453123);
}
float noise (in float2 st) {
float2 i = floor(st);
float2 f = fract(st);
float a = random(i);
float b = random(i + float2(1.0, 0.0));
float c = random(i + float2(0.0, 1.0));
float d = random(i + float2(1.0, 1.0));
float2 u = f * f * (3.0 - 2.0 * f);
return mix(a, b, u.x)
+(c - a)* u.y * (1.0 - u.x)
+(d - b) * u.x * u.y;
}
#define FBM_OCTAVES 1
float fbm (in float2 st) {
// Initial values
float value = 0.0;
float amplitude = .5;
float frequency = 0.;
// Loop of octaves
for (int i = 0; i < FBM_OCTAVES; i++) {
value += amplitude * noise(st);
st *= 2.;
amplitude *= .5;
}
return value;
}
// End FBM
float4 fog(float2 st : TEXCOORD0) : COLOR0 {
//st=rotate(st,u_time);
float2 ce=float2(.5,.5);
float4 color = tex2D(uImage0, st);
color.a = 1.-length(st-ce)*fbm(st*2.5+uProgress*0.01);
//color.r=1.-length(st-ce)*fbm(2.5*st+fbm(st+u_time)+u_time)*6.;
//color.r=fbm(2.5*st+fbm(st+u_time));
return color;
}*/
technique Technique1
{
pass Lines {PixelShader = compile ps_2_0 lines();}
@ -383,4 +437,5 @@ technique Technique1
pass Circle {PixelShader = compile ps_2_0 circle();}
pass Doors {PixelShader = compile ps_2_0 doors();}
pass Doom {PixelShader = compile ps_2_0 doom();}
// pass Rolling{PixelShader = compile ps_2_0 fog();}
}