COLOR PROBLEM with Particle Emitter

Hi!

I’m trying to create a particle emitter. I’ve used Particle Designer to create my .rg file. However there is a strange thing: My particles are transparent although I’ve set all alpha settings to 1!

I’ve experimented and it turns out that the particles aren’t transparent only when I have white color (rgb(1,1,1)).

However if I have rgb(0.5,0.5,0.5) it become gray AND transparent. As soon as I dont have RED, GREEN and BLUE all together set to 1 my particles become transparent. I don’t want transparency. 

My rg file:

{“configName”:“dummy”,

“minRadius”:0,

“maxRadius”:0.02,

“maxRadiusVariance”:0,

“tangentialAcceleration”:10.52,

“emitterType”:0,

“radialAcceleration”:35.28,

“speed”:447,

“maxParticles”:117,

“minRadiusVariance”:0,

“startParticleSize”:5.63,

“angleVariance”:360,

“rotationEnd”:22,

“startColorBlue”:0.5,

“startColorGreen”:0.5,

“startColorRed”:0.5,

“finishColorRed”:1,

“finishColorBlue”:1,

“finishColorGreen”:1,

“startColorVarianceAlpha”:0,

“finishColorAlpha”:1,

“startColorAlpha”:1,

“finishColorVarianceAlpha”:0,

“yCoordFlipped”:1,

“textureFileName”:“particle22446.png”,

“_locked”:true,

“startColorVarianceGreen”:0,

“finishColorVarianceRed”:0,

“gravityy”:2000,

“startParticleSizeVariance”:14.83,

“sourcePositionVariancex”:0,

“startColorVarianceBlue”:0,

“rotatePerSecondVariance”:-477.49,

“rotationStartVariance”:206,

“duration”:0.15,

“rotationEndVariance”:14,

“startColorVarianceRed”:0,

“rotationStart”:264,

“rotatePerSecond”:35.75,

“finishColorVarianceBlue”:0,

“blendFuncSource”:770,

“blendFuncDestination”:1,

“particleLifespanVariance”:4.52,

“radialAccelVariance”:88.86,

“sourcePositionVariancey”:0,

“particleLifespan”:0.83,

“finishColorVarianceGreen”:0,

“tangentialAccelVariance”:-78.35,

“finishParticleSize”:47.45,

“angle”:22.68,

“gravityx”:18.16,

“finishParticleSizeVariance”:27.2,

“speedVariance”:-46.85,

“_brushNum”:2}

Hi @ivan.liljeqvist,

I tried making a similar emitter (solid grey, no opacity) and it works fine. The particles are not transparent. Can you post a screenshot of what is occurring in your project?

Thanks,

Brent

Hi Bren! Thanks for answering!

Sure:

http://gyazo.com/6c42b9e6b67d6d9cd1873738fe8a08a3

I load the emitter like this

local emitter = display.newEmitter( globals.emitterParams ) --emitter params loads the rg file exactly like in the tutorial on this topic

emitter:pause();

emitter.alpha=1

emitter.startParticleSize=block.width*block.height*0.005;

emitter.x = block.x+block.width/2

emitter.y = block.y+block.height/2

emitter:start();

However when I change the color to white I get this: http://gyazo.com/41b5220aa621f80c33b7aa2962e6fedf

No transparency.

The only thing I change was the start- and finish- Red Green and Blue.

Hi Ivan,

This may be a dumb question, but why are you using a .rg file format? Particle Designer should be exporting as JSON. I tried changing my own particle emitter JSON file to a .rg file and specify that in the loading of the emitter, but Corona just errors out.

On another note, are you placing the emitter into a display group? And if so, does that display group have an alpha of less than 1?

Brent

Hi @ivan.liljeqvist,

I tried making a similar emitter (solid grey, no opacity) and it works fine. The particles are not transparent. Can you post a screenshot of what is occurring in your project?

Thanks,

Brent

Hi Bren! Thanks for answering!

Sure:

http://gyazo.com/6c42b9e6b67d6d9cd1873738fe8a08a3

I load the emitter like this

local emitter = display.newEmitter( globals.emitterParams ) --emitter params loads the rg file exactly like in the tutorial on this topic

emitter:pause();

emitter.alpha=1

emitter.startParticleSize=block.width*block.height*0.005;

emitter.x = block.x+block.width/2

emitter.y = block.y+block.height/2

emitter:start();

However when I change the color to white I get this: http://gyazo.com/41b5220aa621f80c33b7aa2962e6fedf

No transparency.

The only thing I change was the start- and finish- Red Green and Blue.

Hi Ivan,

This may be a dumb question, but why are you using a .rg file format? Particle Designer should be exporting as JSON. I tried changing my own particle emitter JSON file to a .rg file and specify that in the loading of the emitter, but Corona just errors out.

On another note, are you placing the emitter into a display group? And if so, does that display group have an alpha of less than 1?

Brent

Hi!

I’ve the same problem.

But I noticed that if background is black “display.setDefault(“background”,0,0,0)” particles are not transparent, if background is not black (some images for background) particles are transparent, and if background is white “display.setDefault(“background”,1,1,1)” particles are completely transparent (invisible!).

Why?

I’mi using Build number 2015.2718 and this is my JSON:

{ "emitterType": 0, "textureFileName": "particle.png", "startColorAlpha": 1, "startColorRed": 1, "startColorGreen": 0, "startColorBlue": 0, "finishColorAlpha": 1, "finishColorRed": 0, "finishColorGreen": 1, "finishColorBlue": 0, "startColorVarianceAlpha": 0, "startColorVarianceRed": 0, "startColorVarianceGreen": 0, "startColorVarianceBlue": 0, "finishColorVarianceAlpha": 0, "finishColorVarianceRed": 0, "finishColorVarianceBlue": 0, "finishColorVarianceGreen": 1, "startParticleSize": 25, "finishParticleSize": 45, "startParticleSizeVariance": 10, "finishParticleSizeVariance": 10, "speed": 200, "speedVariance": 100, "duration": 2.5, "particleLifespan": 10, "particleLifespanVariance": 10, "sourcePositionVariancex": 40, "sourcePositionVariancey": 40, "maxParticles": 100, "gravityx": 0, "gravityy": 400, "radialAcceleration": 0, "tangentialAcceleration": 10, "rotatePerSecond": 0, "rotationStart": 0, "rotationEnd": 0, "rotatePerSecondVariance": 0, "rotationEndVariance": 0, "rotationStartVariance": 360, "minRadius": 0, "maxRadius": 0, "minRadiusVariance": 0, "maxRadiusVariance": 0, "yCoordFlipped": -1, "radialAccelVariance": 0, "tangentialAccelVariance": 0, "angleVariance": 0, "angle": -90, "blendFuncSource": 770 , "blendFuncDestination": 1, }

@ivan,  

Are you sure you’re using ‘Particle Designer’?  That file name looks a lot like a random name generated by my tool.

Whatever the case, please zip up the .rg file and the image you’re using for the particle and share that here.

When I get back tonight I’ll take a look.

-Ed

@Simone

You too should feel free to post a JSON file and image as a zip if you want.  I’ll look at either and try to give an answer.

** UPDATE **

@simone,

Looking at your sample, I think this line is wrong for that background:

"blendFuncDestination": 1,

I seem to remember StarCrunch posting a link (here in the forums) to a great document on blending modes.  I just can’t find it right now.

The Image: http://s4.postimg.org/qrhl3gvih/particle.png

The JSON (like above):

{ "emitterType": 0, "textureFileName": "particle.png", "startColorAlpha": 1, "startColorRed": 1, "startColorGreen": 0, "startColorBlue": 0, "finishColorAlpha": 1, "finishColorRed": 0, "finishColorGreen": 1, "finishColorBlue": 0, "startColorVarianceAlpha": 0, "startColorVarianceRed": 0, "startColorVarianceGreen": 0, "startColorVarianceBlue": 0, "finishColorVarianceAlpha": 0, "finishColorVarianceRed": 0, "finishColorVarianceBlue": 0, "finishColorVarianceGreen": 1, "startParticleSize": 25, "finishParticleSize": 45, "startParticleSizeVariance": 10, "finishParticleSizeVariance": 10, "speed": 200, "speedVariance": 100, "duration": 2.5, "particleLifespan": 10, "particleLifespanVariance": 10, "sourcePositionVariancex": 40, "sourcePositionVariancey": 40, "maxParticles": 100, "gravityx": 0, "gravityy": 400, "radialAcceleration": 0, "tangentialAcceleration": 10, "rotatePerSecond": 0, "rotationStart": 0, "rotationEnd": 0, "rotatePerSecondVariance": 0, "rotationEndVariance": 0, "rotationStartVariance": 360, "minRadius": 0, "maxRadius": 0, "minRadiusVariance": 0, "maxRadiusVariance": 0, "yCoordFlipped": -1, "radialAccelVariance": 0, "tangentialAccelVariance": 0, "angleVariance": 0, "angle": -90, "blendFuncSource": 770 , "blendFuncDestination": 1, }

See my update above.  

also…

I tried these settings and at least now I can see the particles:

"blendFuncSource": 0 , "blendFuncDestination": 769,

Of course, now they are the wrong color…

Yeah, the problem is definitely with your two blend filters (Source and Destination).  You need to select appropriate ones for a WHITE background.

I pinged Steven about this and hopefully I’m remembering correctly and he remembers the link to that blending dicussion.

  • Cheers.

Is it this one?

I thought I’d posted another link, but maybe I just remember following it off the Wikipedia link, which I’ve posted.

Yep… Porter/Duff.

Thanks!

Unfortunately, my memory was wrong.  While this is useful and awesome as a read, it isn’t directly applicable to the current blending issue.  Time to break out the ‘Blue Book’.

http://www.glprogramming.com/blue/ch05.html#id5452795

Thanks again Steven!

Thanks!

Hi!

I’ve the same problem.

But I noticed that if background is black “display.setDefault(“background”,0,0,0)” particles are not transparent, if background is not black (some images for background) particles are transparent, and if background is white “display.setDefault(“background”,1,1,1)” particles are completely transparent (invisible!).

Why?

I’mi using Build number 2015.2718 and this is my JSON:

{ "emitterType": 0, "textureFileName": "particle.png", "startColorAlpha": 1, "startColorRed": 1, "startColorGreen": 0, "startColorBlue": 0, "finishColorAlpha": 1, "finishColorRed": 0, "finishColorGreen": 1, "finishColorBlue": 0, "startColorVarianceAlpha": 0, "startColorVarianceRed": 0, "startColorVarianceGreen": 0, "startColorVarianceBlue": 0, "finishColorVarianceAlpha": 0, "finishColorVarianceRed": 0, "finishColorVarianceBlue": 0, "finishColorVarianceGreen": 1, "startParticleSize": 25, "finishParticleSize": 45, "startParticleSizeVariance": 10, "finishParticleSizeVariance": 10, "speed": 200, "speedVariance": 100, "duration": 2.5, "particleLifespan": 10, "particleLifespanVariance": 10, "sourcePositionVariancex": 40, "sourcePositionVariancey": 40, "maxParticles": 100, "gravityx": 0, "gravityy": 400, "radialAcceleration": 0, "tangentialAcceleration": 10, "rotatePerSecond": 0, "rotationStart": 0, "rotationEnd": 0, "rotatePerSecondVariance": 0, "rotationEndVariance": 0, "rotationStartVariance": 360, "minRadius": 0, "maxRadius": 0, "minRadiusVariance": 0, "maxRadiusVariance": 0, "yCoordFlipped": -1, "radialAccelVariance": 0, "tangentialAccelVariance": 0, "angleVariance": 0, "angle": -90, "blendFuncSource": 770 , "blendFuncDestination": 1, }

@ivan,  

Are you sure you’re using ‘Particle Designer’?  That file name looks a lot like a random name generated by my tool.

Whatever the case, please zip up the .rg file and the image you’re using for the particle and share that here.

When I get back tonight I’ll take a look.

-Ed