281 {
282 float slow_time = time_ms * 0.0002f;
283
284 float blob_scale = 800;
285 uint16_t primary_noise =
inoise16(coord.
x * blob_scale, coord.
y * blob_scale, slow_time * 1000);
286 uint16_t secondary_noise =
inoise16(coord.
x * blob_scale * 0.5f, coord.
y * blob_scale * 0.5f, slow_time * 1500);
287
288 float blob_value = (primary_noise + secondary_noise * 0.3f) / 65536.0f;
289
290 if (blob_value > 0.6f) {
291
292 float intensity = (blob_value - 0.6f) / 0.4f;
293 return palette.mapColor(0.1f, intensity);
294 } else if (blob_value > 0.3f) {
295
296 float edge_factor = (blob_value - 0.3f) / 0.3f;
297 return palette.mapColor(0.2f, edge_factor);
298 } else {
299
300 return palette.mapColor(0.8f, 0.2f);
301 }
302}
UINumberField palette("Palette", 0, 0, 2)
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.