change cloud color and camera/cloud far clip problem

mickey

24-01-2009 06:11:40

Hi

I have 2 questions

First, i'm only using the CAELUM_COMPONENT_CLOUDS to add clouds to my scene.

1. Is there a way to change the cloud color to another color? I am using a sunset scene skybox and id like the clouds to match the cloud colors of the skybox.

2. I need to set my camera far clip distance to only 10,000, but when I do that, I can see the clouds plane cut off. Is there a way so that the cloud would stretch as far as my far clip distance or at least not show where the plane ends?

Thanks.

cdleonard

25-01-2009 08:07:42

First, i'm only using the CAELUM_COMPONENT_CLOUDS to add clouds to my scene.
In this case you might be better off just creating the cloud objects without a CaelumSystem. You can get more control that way.

1. Is there a way to change the cloud color to another color? I am using a sunset scene skybox and id like the clouds to match the cloud colors of the skybox.
Cloud color depens on parameters passed to FlatCloudLayer::update (in a somewhat unpredictable way). You can try playing with those parameters.

2. I need to set my camera far clip distance to only 10,000, but when I do that, I can see the clouds plane cut off. Is there a way so that the cloud would stretch as far as my far clip distance or at least not show where the plane ends?
FlatCloudLayer::setFadeDistances(farClip * 0.8, farClip * 0.9); Something like this should fade the clouds out instead of cutting them in an ugly way. Unfortunately these distances are measured horizontally; so a very high layer would still be cut off. I guess you could set the far fade distance to something like sqrt(farclip* farclip - deltaHeight * deltaHeight) to be sure; but it wouldn't look good.

mickey

25-01-2009 18:00:20

Hi

FlatCloudLayer::setFadeDistances(farClip * 0.8, farClip * 0.9) works, but i guess it also depends on the layer's height? The higher it gets, the more the illusion breaks.

Could you help me with using the FlatCloudLayer::update (...) function? Do I manually call this on ExampleFrameListener::frameStarted(...) ?

Because I did, what I want to happen is, I want the clouds to animate, and have a fix color. For instance for simplicity lets say I want to have red clouds, something like this won't work on frameStarted which what I have right now:

gCaelumSystem->getCloudSystem()->getLayer(0)->update( evt.timeSinceLastFrame * 0.01f, Vector3(0.f, -1.f, 0.f), ColourValue::Red, ColourValue::Red, ColourValue::Red);

The clouds color slowly changes color from white to red to black and then morning color again.

Also, I'd like the clouds to animate very slow, no matter how small the timePassed value i enter, the cloud would not slow down.

And nope, I love your system so I want to stick with it :)

cdleonard

26-01-2009 06:46:42

CaelumSystem will call update by itself. If you want to override the parameters it send you must do it after Caelum::updateSubcomponents and before rendering. This sort of means you can use CaelumSystem as a FrameListener because you get no control on the order of the calls.

Also; in order to fully control the animation you should make sure CaelumSystem won't "advance timing" by itself. CaelumSystem::setTimeScale(0) should reliably freeze it.

mickey

28-01-2009 12:35:34

Thanks, it worked.

I did not register the caelum as a frame listener, and i did this on my frameStarted method:

gCaelumSystem->updateSubcomponents( evt.timeSinceLastFrame);
ColourValue orange(0.8f, 0.5f, 0.2f);
gCaelumSystem->getCloudSystem()->getLayer(0)->update( evt.timeSinceLastFrame * 256.f, Vector3(0.f, -1.f, 0.f), orange, orange, orange);

Thanks for the clouds!