shader integers

This commit is contained in:
Crispy 2023-09-22 21:24:21 +02:00
parent 03e407c1eb
commit 039d6b2540
13 changed files with 17 additions and 18 deletions

View file

@ -4,7 +4,7 @@
{
[NoScaleOffset]
_LastFrame ("Render texture", 2D) = "white" {}
_Rule("Rule", Int) = 110
_Rule("Rule", Integer) = 110
}
SubShader
{
@ -48,7 +48,7 @@
{
const uint x = (p.x + dx) % WIDTH;
const uint y = (p.y + dy) % WIDTH;
return _LastFrame[uint2(x, y)].b > 0;
return _LastFrame[uint2(x, y)].b > 0.1;
}
float3 frag (v2f i) : SV_Target
@ -60,13 +60,12 @@
return state(p, 0, 0);
}
int permutation =
(state(p, -1, 1)<<2) |
(state(p, 0, 1)<<1) |
state(p, 1, 1);
(state(p, -1, 1) << 2) |
(state(p, 0, 1) << 1) |
state(p, 1, 1);
float next = (_Rule >> permutation) & 1;
return float3(i.uv * next, next * (_SinTime.y * 0.4 + 0.6));
// return next;
}
ENDCG
}

View file

@ -4,7 +4,7 @@
{
_LastFrame ("Texture", 2D) = "white" {}
[Toggle]
_Running ("Running", Int) = 0
_Running ("Running", Integer) = 0
}
SubShader
{