Flickering problem

Hi there !

I’ve made a particle engine which work very well, except that when I draw more than one hundred particles, I get an horrible flickering effect… I’ve tested the code with two differents CPUs (one powered by nvidia geforce440, the other by ATI radeon 9200).
That’s strange because I don’t get this annoying flickering effect while drawing object or full scene… I only get it when I use my particle system…

How could I remove it ? I’m running Lwjgl 0.9 in fullscreen… (if you need more informations about my code, simply ask what you want to know :))

Thanks
Chman

Edit: forgot to say that I’ve tested the code with and withouth vSync… But it doesn’t change anything…

What kind of blending do you use ? Do you use different projection matrix for drawing particles ? Does entire screen flicker or only parts of screen near particles ?

First thanks for your fast answer :slight_smile:

I use glBlendFunc(GL_SRC_ALPHA, GL_ONE); to blend the particles and the same projection matrix that I use to draw the scene (I don’t change matrix at all).

About the flickering, it only happen on the part of the screen where the particles are…

Does the same thing happen without blending? Have you made sure to turn depth writes off for particles (yet leave depth testing on)? What about if you switch alpha testing instead of blending?

Depth testing is off when rendering the particle…
I’ve just tested with/without blending and/or with/without deph testing but it doesn’t remove flickering…

What do you mean exactly by “alpha testing instead of blending” ? I should use glAlphaFunc ?

If the flickering still happens with blending off, it’ll probably happen with alpha testing as well. :frowning: ‘Flickering’ is a pretty vauge description though, how about a screenshot?

I can’t post a screenshot of my problem, because flickering only happen in animated mode :slight_smile: It’s not visible on static images…
I will try to make a little video shot and post the link here asap !

Here it is :
http://hourdel.chez.tiscali.fr/videoshot.zip

Sorry for the bad quality… This video shows my flickering problem (in reality, it’s not so exagerated, it’s my video generator which make more flickering :P)… Don’t know if it can help.

Chman

I have all common codecs installed (divx, xvid, 3ivx, wma[several versions], indigo and a handfull of others). However, I can’t open the file and the fourCC seems to be empty?!

The codec seems to be really bad since the compression ratio is that huge. I suggest using xvid. It’s free and about as good as divx.

I get a 403 error, I wonder if I have Opera configured wrongly somewhere…

If I left click the link I get a 403, if I right click and “save link to disk” I am able to download the file. The file though is not playable on my system either. Win2k (SP4), Quicktime, Realplayer, xvid.

Ouch sorry ! My video shooter use a very bad codec…

I’ve updated the file, it’s now an uncompressed avi.

(tiscali is a bad server for homesite, so you should do a right click -> download to get the file…)

Can’t download it. Tried the link for yourself? :slight_smile:

Here it is :slight_smile: Just an error in the link :
http://hourdel.chez.tiscali.fr//videoshot.zip

Kinda nice to use uncompressed avi in that case. No keyframes - so you can jump from frame to frame (back and forth).

It appears that the content of the backbuffers differs. Only looking at the even frames looks ok and only looking at the odd frames is also ok, but together they look just weird.

I guess you’ve clearing disabled, but draw the background without disabling blending. Enable clearing and it should be ok (as a test) or just disable blending at the end of your particle stuff.

My clearing stuff is enabled :

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

and init part :

glClearDepth(1.0);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);

[quote]I guess you’ve clearing disabled, but draw the background without disabling blending. Enable clearing and it should be ok (as a test) or just disable blending at the end of your particle stuff.
[/quote]
Clearing is enabled and I draw the background with blending disabled :P. I’ve tested what you suggest but it doesn’t work too…
Strange isn’t it ?

I think I’m gonna leave my classic particle system and try to convert it so as it will use ARB_point_sprite extension… Maybe it will work (only on newer card :-/).
Thanks for your help anyway !

If someone knows how to solve this problem, you’re welcome :slight_smile:

Chman

Hi again :slight_smile:

I find something new after doing some tests !
So, I’ve tested using the ARB_point_sprite extension, I get the same problem.
BUT : the particle engine starts flickering only when it’s creating a new particle ! If I made a single particle pass (no particle re-created), it works very well ! (using the extension or not)

That’s pretty strange… So I think it’s not an OpenGL problem… Maybe I’m doing something wrong with Java… I’ll post some news about it !

Chman

Stay calm chman…
Stay calm…

I’m so STUPID ! But STUPID !
Ok I’ve resolved the “problem”… Which wasn’t a real problem… I was just making some stupid things with my for loop and the return statement, so the particle was re-creating some thounsand times each frame or wasn’t created at all…

Stupid I say…

Forgive about this useless post which only makes you see how stupid I can be when I’m tired :stuck_out_tongue:

Chman

Hi !

I’ve finished my particle engine ! It’s very powerful and can handle scripting (with DynamicJava) to make custom effects, so I can do what I want with that engine :slight_smile:
Oh, if the graphics card support it, it can use ARB_point_sprite for faster rendering :slight_smile:

Here are some screenshots if you wanna see it in action :

http://hourdel.chez.tiscali.fr/images/snap007.jpg
http://hourdel.chez.tiscali.fr/images/snap006.jpg
http://hourdel.chez.tiscali.fr/images/snap005.jpg

Thanks for your help :slight_smile:

Chman

cool, planning a live demo via webstart?