• 2D
  • Is there a way to have a particle system use several textures at the same time?

I have a sparkle effect which uses two instances of the same sprite - one with a color and one in white (to give it brightness). Attached is an example of the usage.

I would like to do this in a particle system (have particles of the two sprites overlayed), but it only allows you to use one texture (and for that matter only set one color). Is there a way to directly circumvent that, or generate the desired effect otherwise using a particle system?

You could just composit two images in an editing app to make a single texture.

If it needs to happen in realtime, just add custom shader material to the particle node and blend the textures in the shader.

Unfortunately I can't manually combine them as I would like the color to be changeable at runtime, but I can't just change the modulate because the smaller sprite needs to remain white. I'll look into the custom shader stuff, thanks!

Assuming we're dealing with 2d particles, you can just assign particle texture as you would normally, then create new shader material (under CanvasItem section of the Particle2D node) and paste this shader code:

shader_type canvas_item;
render_mode blend_mix;
uniform float shiny_scale = .5;

void fragment(){
	const vec2 half = vec2(.5, .5);
	
	COLOR = texture(TEXTURE, UV) * COLOR;
	vec2 uv_scaled = clamp( (UV - half) / shiny_scale + half, vec2(0.0, 0.0), vec2(1.0, 1.0));
	vec4 t = texture(TEXTURE, uv_scaled);
	COLOR = mix(COLOR, t, t.a);
}

This will draw the texture twice, once normally modulated and once white and scaled over the modulated texture. Note that shiny_scale property will appear under Shader Params when the shader becomes active. Changing it will scale the white particle. In order for this to work properly all border pixels of your texture must be fully transparent.

You could also use a single texture with the particle colors configured to be brighter than Color(1, 1, 1). This creates an overbright effect which can be used to saturate colors to white, as colors can be extremely bright in Godot. To specify overbright colors in a color picker, enable RAW mode in the ColorPicker then enter values manually in the individual spinboxes (with 1 being the maximum non-overbright brightness).