SkyControl Night Too Bright

I like the SkyControl plugin, it is a much needed and useful addition to this engine.

I do wonder why at night time the sky is so bright, the clouds are white. In real life clouds are dark at night. Is there any way this can be changed?

Thanks.

Yes it can be changed. The best place to change it would be in SkyControlCore.updateCloudsColor()

In SkyControl, nighttime clouds are bright when the moon is in the sky and darker when it’s not. Are you interested in both situations, or just one?

Thanks for the reply.

In real night sky the clouds always seem black to me whether the moon is out or not.

The method you mention seems to be protected. Do you recommend I extend SkyControl to access this?

I’ll give some thought to different ways the effect you want could be achieved. If it can be cleanly added to SkyControl, I’ll do that.

The current updateCloudsColor() definitely has room for improvement. For instance, it doesn’t take the moon’s phase into account.

But if you’re in a hurry, by all means go ahead and extend the class to override updateCloudsColor(). Similar code with factor=0 when sunUp is false might give you what you want.

I am not having much luck extending the class because it is full of private stuff.

To be honest, SkyControl wasn’t designed to be extended. But that was more oversight on my part than a conscious design choice. I’ll change ‘numCloudLayers’ and ‘cloudLayers’ and ‘CloudLayers.setColor()’ in the repository ASAP. Let me know if you need more.

Or were you extending SkyControlCore? Because extending SkyControl probably makes more sense.

@Vertex I’ve made changes to SkyControl having to do with the moon’s illumination of clouds and such. The net effect is to make nighttime clouds darker in most cases, so you may want to pick up these changes. In the Google Code repository, it’s revision 313. If you’re using the plugin, you need last night’s update (Version 1.0.1399).

1 Like

I haven’t noticed the clouds being any darker by default, but it seems I can now have more control when extending the SkyControl class. Thanks.

1 Like

Hi, I’m not 100% sure it’s relevant, but I’ll ask here anyways. Is there a way to make the cloud layers more dense? I set alpha to 1 to be the most opaque as possible, but there are big “holes” in the cloud layer, so I was wondering if there was a way to like duplicate the cloud layers or simply make it very very dense (e.g. so that almost in no occasion we can see the stars or sun or moon for example) ?

Thx

1 Like

Not relevant, but I’ll answer it here anyway. (Why are people so shy about starting new topics, I wonder?)

Cloud layers in SkyControl are based on textures, and the default texture (“Textures/skies/clouds/fbm.png”) is about 10% cloudy. For an foggy or overcast sky, you need to specify a different texture, such as “Textures/skies/clouds/overcast.png” (which is 100% cloudy) for at least one of your cloud layers. You could do this as follows:
[java]
int layer1Index = 1;
CloudLayer layer1 = skyControl.getCloudLayer(layer1Index);
String overcastAssetPath = “Textures/skies/clouds/overcast.png”;
float layer1Scale = 1f;
layer1.setTexture(overcastAssetPath, layer1Scale);
[/java]
then adjust the opacity using something like
[java]
float layer1Opacity = 0.9f; // almost opaque
layer1.setOpacity(layer1Opacity);
[/java]

2 Likes

Hi, thanks for the fast reply. I found that it was making the whole sky too white and blend, but I used the texture swap trick and opened Photoshop and made a new heavy clouds texture and i’m quite happy with the result, except that, as per stated by the OP, the sky is nearly white even at 1:00 AM. I read that there is supposed to be an updateCloudsColor() function, but is it exposed to the public interface yet? I think it should, like through the getUpdater() interface or something. I have the last revision commited 3 hours ago.

If the clouds seem bright at night, it’s because they’re lit by the moon. If you hide the moon using setPhase(null) that will make the clouds much darker. Or you can extend SkyControl and override its updateCloudsColor() method, as I suggested to the OP.

OK BUT… isn’t sky_control.getCloudLayer(0).setColor(ColorRGBA.Red); supposed to make the first cloud layer red for instance? I could not achieve to change the clouds color even with that function, is this normal?

If you browse SkyControlCore.updateCloudsColor() you can see that it uses CloudLayer.setColor() to set the color of each cloud layer. As long as SkyControl is enabled, it will invoke updateCloudsColor() on every frame, overwriting any setColor() you do on your own.

The upshot is that setColor() is only useful internally.

1 Like

Yes, that’s exactly what I figured out this morning. I also found out in the same function you mentioned that MyColor.saturate(baseColor); causes more harm than good at night by saturating the clouds color so that they are very white. By commenting out this line I could achieve much more realistic clouds at night. For rainy days, I would have liked the clouds to be more gray than white and I could achieve this by changing the baseColor variable.

All in all, I think you should expose baseColor setter/getter (and/or updateCloudsColor() function) in the public interface. It would cause no harm, be backwards-compatible and let the programmer have more power over situations like heavy cloud coverage, rain storms etc… I find other uses too, for specific games like it could be used to do very funky/fantastic skies for games that are meant to be less realistic.

I gave you +1 for all the follow ups. Let me know if you add the baseColor setter/getter in the public interface, I’ll revert my local changes, upgrade to the last version and test if out if you want :smiley: Thank you.

I’m busy with another project and feeling a bit reluctant to add more bells and whistles to SkyControl right now. I’m happy to answer questions and fix bugs though.

Since you apparently don’t wish to extend SkyControl, another approach would be to instantiate SkyControlCore directly instead of using SkyControl. That should allow you to manage cloud layers directly [using setColor() for example] without having your settings overwritten on every frame. I don’t know if anyone’s actually done this yet, but in theory it ought to provide a nice middle ground between using SkyControl and applying SkyMaterial directly to a DomeMesh.