 
 			switch (FRAME.attractors[i].type) {
 				case ATTRACTOR_TYPE_SPHERE: {
-					dir = normalize(rel_vec);
+					dir = safe_normalize(rel_vec);
 					float d = length(local_pos) / FRAME.attractors[i].extents.x;
 					if (d > 1.0) {
 						continue;

					amount = max(0.0, 1.0 - d);
				} break;
				case ATTRACTOR_TYPE_BOX: {
					dir = normalize(rel_vec);

					vec3 abs_pos = abs(local_pos / FRAME.attractors[i].extents);
					float d = max(abs_pos.x, max(abs_pos.y, abs_pos.z));

	return true;
}

vec3 safe_normalize(vec3 direction) {
	const float EPSILON = 0.001;
	if (length(direction) < EPSILON) {
		return vec3(0.0);
	}
	return normalize(direction);
}

#GLOBALS

void main() {
