OcclusionQuery: how to ignore some objects?

Posted by ApocKalipsS on Game Development See other posts from Game Development or by ApocKalipsS
Published on 2013-11-09T13:01:46Z Indexed on 2013/11/09 16:16 UTC
Read the original article Hit count: 190

Filed under:
|

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?

© Game Development or respective owner

Related posts about XNA

Related posts about occlusion