Lf3THn4D
23-03-2009 03:58:20
I've split up the topic from here: viewtopic.php?p=55425#p55425
From the looks of it, we either have to use another method for the lighting update, or we need to make sure that lights are only updated once every frame. I think the best and most fool proof way is to change the way lighting is updated. However, I'm not very certain since I'm not familiar with the lighting code. It seemed to me that it's only used to set the mAffectsVisibleZone boolean value that is used in PCZSceneManager::findLightsAffectingFrustum(). Other than that, the light zone list still gets added?
Btw, I found a bug in the PCZSceneManager::_findVisibleObjects(). It's getting the frame count from Root::getSingleton().getNextFrameNumber(). This is bad because when we need to render the scene multiple times, I.E. rendering scene within the compositor passes, nothing will get rendered in that compositor pass. I think we should revert to the commented line which just increment the counter.
Hmm... But there was a very good reason (which I can't remember right now) why I commented that line and went with getNextFrameNumber...
Oh.. hmmm.. okay, how about moving the frame counter thing into the renderScene method? Or is that even worst? As it is, I can't get my refraction compositor to work properly due to this. Switching to the previous method helped there. Though like you said, that might have caused some other problem I'm not aware of. I'll try and dig through to see if I can spot it.
I vaguely recall that it might have been something to do with lighting...
Ah... I think I see it. Lights are updated with a frame count check. Hmmm... It's using it to check against the homezone's frame count. That's rather confusing. What's that for?
I am going by memory (away from my work computer right now) but I think it's because the recursive nature of the PCZSM. Without the check, the lights get updated multiple times in the same frame which caused problems I think...
From the looks of it, we either have to use another method for the lighting update, or we need to make sure that lights are only updated once every frame. I think the best and most fool proof way is to change the way lighting is updated. However, I'm not very certain since I'm not familiar with the lighting code. It seemed to me that it's only used to set the mAffectsVisibleZone boolean value that is used in PCZSceneManager::findLightsAffectingFrustum(). Other than that, the light zone list still gets added?