[SOLVED] How does the precipitation system works !?

XpLoDWilD

28-10-2008 09:23:09

Hi,

I tried to use the precipitation system by different way (directly in the ComponentMask, or added separately using setPrecipitationController), but I can't get anything working (or the better I can get is a gray semi-transparent overlay).

Can you do a little demo of the precipitation system ? Or a little example code ? Thanks !

XpLoDWilD

28-10-2008 09:42:47

After tricking a little, I can get the precipitations working in the CaelumDemo using this :


// Set time acceleration.
mCaelumSystem->getUniversalClock ()->setTimeScale (512);

// [ADDED] Precipitation system
mCaelumSystem->setPrecipitationController(new PrecipitationController(mScene));

mCaelumSystem->getPrecipitationController()->createViewportInstance(win->getViewport(0));

mCaelumSystem->getPrecipitationController()->setPresetType(PRECTYPE_RAIN);
mCaelumSystem->getPrecipitationController()->setIntensity(0.8);
mCaelumSystem->getPrecipitationController()->setSpeed(0.3);

// Register caelum as a listener.
mWindow->addListener (mCaelumSystem);


Plus the update function in the frameEnded();


But when I copy this in my game, I can only see rain in the early first frame, and then it disappears.. Is there some kind of limitations when there is not enough clouds coverage or something like that ?


Edit : I was able to screenshot them :

==> This is the very first frame



==> And then the other frames

I'm using latest SVN of course

cdleonard

28-10-2008 11:17:14

There's UI to control precipitation settings in CaelumLab. Try to enable precipitation from there and see if it works.

Your first frame looks significantly different from the following frames; the sky is gray. That should not happen; how did you get a gray sky?. My guess is that updating is messed up somewhere.

No; there is no link between cloud coverage and precipitation.

XpLoDWilD

28-10-2008 11:38:06

It works in CaelumLab aswell as in the modified Caelumdemo. Just in my game that it doesn't work.

The first frame glitch is maybe due to the fact that the update is done in frameEnded instead of frameStarted, but in the next frames it works well.

Anyway, the precipitations still doesn't work in my game, and I don't know why...

XpLoDWilD

28-10-2008 11:49:56

Alright, I found the solution :
I've set the TimeScale to 0 (because every second I update manually the time with real time), setting it to 1 fixed the problem.

I think it's a bug because there still shoud be precipitations even when the time is paused (or atleast you should see "stopped" rain).

cdleonard

30-10-2008 17:22:03

Indeed; it's a bug. I fixed it in latest trunk; you will now see frozen rain.