ParticlesGpu particlesSourceColor incorrectly resolves to black

Hi,

I have a weird issue with particlesSourceColor input in particlesGpu. I created an example patch to illustrate the issue. For some reason particlesGpu renders black particles although the source image connected to particlesSourceColor does not contain them.

Here’s the network. Particle source is an UV square, color input is the banana, there’s a custom orthographic cam and the transform after render just adds a red background for showing the black particles.

The output has a lot of black particles:

I wonder if it’s somehow related to alpha values in the source image (although all the alpha values in the banana should be either 0 or 1?) as a circle with some softness as the color source looks like this:

Here’s the example patch:
test.2.toe (484.5 KB)

I am using TD 2023.12120 and particlesGpu shows Version 2.2.11 and .tox Save Build 2023.12096. Also tested with TD 2023.11600 (particlesGpu version 2.2.10) with similar results.

I would greatly appreciate if someone has any ideas on how to get the banana example working without black particles in the render. Thanks a lot in advance!

I believe that the particle emission is more or less binary with regards to alpha, so if the alpha has any alpha at all above 0 it still gets emitted as a particle. Since many images may have a feathered or slightly soft edge of alpha going into a black background, you might still get dark particles emitted, maybe try a hard clipped object that has no softness or feathering around the edges of the alpha.

Hi @ohss,

looks to me like an issue with the line material which is selected on the Material Page of the component. Checking why it does not take on the alpha…

cheers
Markus

Hi,

Thanks a lot!

I was able to resolve my issue with the GLSL shader below and by setting the Fade Out value to 0 on the particlesGpu operator.

out vec4 fragColor;
void main()
{
	vec4 colorIn = texture(sTD2DInputs[0], vUV.st);
	vec4 color = vec4(0.0);
	
	if (colorIn.a == 1.0) {
		color = colorIn;
	}
	
	fragColor = TDOutputSwizzle(color);
}

For my current use, making the particleSourceColor input alpha values binary is ok and that sort of resolves my issue.

However, if I set the the Fade Out value in particlesGpu something else than 0, the particles fade to black (Compositing options in particlesGpu don’t affect this). For me that’s not an issue right now but it’s probably not intended behavior?

image

And as mentioned in the original post, < 1 alpha values change the grayscale value of the particles:

So yeah, my initial issue is solved by the simple GLSL shader that sets alpha values to either 0 or 1 but I’d say there’s some issues with transparency that could be looked into if possible :slight_smile:

These tests were with TD 2023.11600 / particlesGpu 2.2.11

Thanks!