Skip to content
Snippets Groups Projects
Unverified Commit 59828b4a authored by TheJackiMonster's avatar TheJackiMonster
Browse files

Fixed spinning trails artifacts

parent 574a1706
No related branches found
No related tags found
1 merge request!106Created initial firework project
......@@ -54,22 +54,6 @@ void main() {
return;
}
vec3 positions [2];
uint viewIndex = instanceIndex;
if (viewIndex > startIndex) {
viewIndex--;
}
for (uint i = 0; i < 2; i++) {
const uint index = (viewIndex + i) % points.length();
positions[i] = points[index].position;
}
vec3 pos = positions[0];
vec3 dir = normalize(cross(positions[1] - pos, pos - camera));
const float trailFactor = mediumDensity / friction;
for (uint i = 0; i < count; i++) {
......@@ -79,11 +63,9 @@ void main() {
const vec3 position = points[index].position;
const float size = points[index].size;
const vec3 velocity = points[index].velocity;
if (i > 0) {
dir = normalize(cross(position - pos, pos - camera));
pos = position;
}
const vec3 dir = normalize(cross(abs(velocity), position - camera));
vec3 offset = dir * size;
float density = trailFactor * (1.0f - u * u) / size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment