From 3682069d3779d2c8d7363a9a8cb216e186c8d2d8 Mon Sep 17 00:00:00 2001
From: TheJackiMonster <thejackimonster@gmail.com>
Date: Wed, 27 Jul 2022 08:28:06 +0200
Subject: [PATCH] Added variation to lifetime and particle velocity

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
---
 projects/fire_works/shaders/generation.comp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/projects/fire_works/shaders/generation.comp b/projects/fire_works/shaders/generation.comp
index aefc7dc9..eb585236 100644
--- a/projects/fire_works/shaders/generation.comp
+++ b/projects/fire_works/shaders/generation.comp
@@ -109,7 +109,7 @@ void main() {
         return;
     }
 
-    lifetime = events[event_id].lifetime;
+    lifetime = events[event_id].lifetime * (1.0f + 0.1f * randomData[(id + 1) % randomData.length()]);
 
     vec3 direction;
     if (dot(events[event_id].direction, events[event_id].direction) <= 0.0f) {
@@ -152,7 +152,7 @@ void main() {
         smokes[sid].eventID = event_id;
     }
 
-    velocity += normalize(direction) * v;
+    velocity += normalize(direction) * v * (1.0f + 0.1f * randomData[(id + 2) % randomData.length()]);;
 
     const float split = pow(1.0f / events[event_id].count, 1.0f / 3.0f);
 
-- 
GitLab