Zero gap particle trail

With the power of 2 gpu particle nodes it’s possible to emit particles for a sub emitter using a particle shader and do nothing with the main emitter lol

First image is the meat of the code that does all the work and second image is your typical particle setup which has your usual gaps at high speeds by itself

The provided scene file contains everything you need just make it a child to a node you want it to follow and it just works

The 10000 particles is just a placeholder and this works with far less depending on how much you can compromise on the speed of the object the trail is attached to and more importantly the spacing (more spacing = less particles needed)

Shader code
shader_type particles;

void start() {
	CUSTOM.xyz = EMISSION_TRANSFORM[3].xyz;
}

void process() {
	float spacing = 0.125;
	
	for (int i = 0; i < int(distance(EMISSION_TRANSFORM[3].xyz, CUSTOM.xyz) / spacing); i++) {
		CUSTOM.xyz += normalize(EMISSION_TRANSFORM[3].xyz - CUSTOM.xyz) * spacing;
		
		mat4 custom_transform = mat4(1.0);
		custom_transform[3].xyz = CUSTOM.xyz;
		emit_subparticle(custom_transform, vec3(0.0), vec4(0.0), vec4(0.0), FLAG_EMIT_POSITION);
	}
}
Tags
particle trail, trail
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Turtle

Related shaders

guest

5 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
erBimo
erBimo
23 days ago

the link for the demo is not working

Jon
Jon
21 days ago
Reply to  Turtle

Yeah it’s down again unfortunately. “This content is no longer available.”