OcclusionQuery: how to ignore some objects?
- by ApocKalipsS
I'm trying to make a LensFlare effect when the player watch the sun in my XNA 4.0 Game.
To do this, I use OcclusionQuery, here's my code:
http://pastebin.com/meAkdwmD
I also have some models, a terrain and a skybox.
Here's my main Draw code:
terrain.Draw();
model1.Draw();
model2.Draw();
skybox.Draw();
lensFlare.UpdateOcclusion();
lensFlare.Draw();
The problem is that the occlusion considers the sun to be behind the skybox, and the lensFlare wasn't showing up.
So I moved lensFlare.UpdateOcclusion() before the drawing of the Skybox, and now the lensFlare appears, but my skybox is blinking (it's like it disappear and reappear at each frames...)
How do I ignore the skybox in the occlusion?