I have the next process:
- draw background
- draw objects and blend with background (1)GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA
- draw particle effect with blending (2)GL10.GL_SRC_ALPHA, GL10.GL_ONE in order to highlight overlapping particles
Problem - when I draw particle they are additionally blended with background and becomes very bright.
Simply what I need is to blend particles with (2) and than all together to blend with background using (1).
Not working solutions:
Here is screen to show the difference. On the right desired result, on the left particles are blended with background.
img:
I will appreciate any help...
Latest Updates: I was able to get the color I want...but... (Seems this way will move me nowhere) I have rendered background with alpha = 0 and than use blend Function from GL11Ext: glBlendFuncSeparate(GL10.GL_SRC_ALPHA, GL10.GL_DST_ALPHA, GL10.GL_ONE, GL10.GL_ONE);
GL10.GL_SRC_ALPHA, GL10.GL_DST_ALPHA - the colors are blended only if they have alpha(bg dont have now)
GL10.GL_ONE, GL10.GL_ONE - alpha is set to maximum for all written particles to simulate additive blending
It works fine as you can see...except the black color filling area where particles image has alpha 0..and whats bad that in result image that black color has alpha 1 so I can not replace it in any way...
EDIT_2 General problem in simple words: I need to draw a red(0xff0000) glowing(additive blending) effect. On black background it is ok, but if I would take green(0x00ff00) than the result color would be close to 0xffff00
Any ideas?
GL10.GL_SRC_ALPHA, GL10.GL_ONE in order to highlight overlapping particles
There is no other way than additive blending to avoid the need of sorting particles. If you still want to stick with this to avoid overlapping of the particles I suggest you to inject a bleding controll into the rendering so you can reduce brigthness of the rendered particles or you can reduce the brightness of the particle texture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With