godot 4.5
I have a simple shader to move the particles up when they are inside the tile map and delete if they are in the tilemap on the first frame. the tilemap has a light ocluder with sdf on every tile.
the Issue is they are not colliding when off camera. you can see that as they are just rising up from off screen. the emission size is smaller than the bottom of the tile map.
i set the visibility rect to 10000x100000 and that didn’t fix it.
i made the viewport bigger and it did the same thing at the edge of the new viewport.
I tried setting the emission rect so small it cant spawn in the tilemap and that reduced the effect because less particles made it to the tilemap but is still happened
code for the shader (random function removed for discord word limit)
shader_type particles;
uniform float windSpeed;
uniform vec2 emissionSize;
uniform sampler2D baseColor;
uint hash(uint x) {
x = ((x >> uint(16)) ^ x) * uint(73244475);
x = ((x >> uint(16)) ^ x) * uint(73244475);
x = (x >> uint(16)) ^ x;
return x;
}
void start() {
CUSTOM.ba=vec2(0);
uint base_number = NUMBER;
uint alt_seed = hash(base_number + uint(1) + RANDOM_SEED);
COLOR=texture(baseColor,vec2(rand_from_seed(alt_seed)));
TRANSFORM[3].xy=vec2(emissionSize.x*rand_from_seed(alt_seed),emissionSize.y*rand_from_seed(alt_seed));
VELOCITY.xy=vec2(mix(-60,-80,rand_from_seed(alt_seed))*windSpeed,mix(-5,5,rand_from_seed(alt_seed)));
CUSTOM.x=mix(-2,2,rand_from_seed(alt_seed));
CUSTOM.y=0.0;
//if (COLLISION_NORMAL!=vec3(0))ACTIVE=false;
}
void process() {
if (RESTART && COLLIDED) ACTIVE=false;
CUSTOM.y+=0.02;
if (COLLIDED) VELOCITY.y+=-3.;
else if (VELOCITY.y<50.) VELOCITY.y+=.5;
if (CUSTOM.y>1.0){
CUSTOM.x*=-1.0;
CUSTOM.y=0.0;
}
uint base_number = NUMBER;
//VELOCITY.xy+=normalize(vec2(VELOCITY.y,-VELOCITY.x))*CUSTOM.x*.5;
}