SkyControl Directional Light Dark

This may or may not be related to the skycontrol plugin that @sgold wrote.

This is my code I am using to set up the sky control:
[java]
private void setupSky() {
sun = new DirectionalLight();
localRootNode.addLight(sun);

    ambientLight = new AmbientLight();
    localRootNode.addLight(ambientLight);
    
    boolean starMotion = true;
    boolean bottomDome = true;
    skyControl = new SkyControl(
            this.app.getAssetManager(), this.app.getCamera(), 0.9f, starMotion, bottomDome);
    localRootNode.addControl(skyControl);
    skyControl.getUpdater().setMainLight(sun);
    skyControl.getUpdater().setAmbientLight(ambientLight);
    skyControl.getSunAndStars().setHour(12);
    skyControl.getSunAndStars().setObserverLatitude(0.9f);
    skyControl.setCloudiness(0.8f);
    skyControl.setEnabled(true);
}[/java] 

This is how it looks with the skyControl.getUpdater().setMainLight(sun); line commented out:

And this is how it looks with that line in:

I want it to be bright like the first image. It seems setting the skycontrol to control the directional light makes it darker. I am using the terrain lighting material definition for this terrain.

Thanks in advance!

Yes, if you tell SkyControl to update the direction of the sunlight, it will also update its intensity. Sunlight is more intense at noon than in the early morning and late afternoon.

Currently there’s no way to tell SkyControl to update one but not the other. However, you could program such behavior in your SimpleApplication update method.

The screenshot is actually at noon, you can see the sethour call in the snippet i posted. I like that the intensity varies, but tomorrow i will look into the source of skycontrol and see if I can modify it to have the default intensity at noon and keep the falloff towards dusk and dawn

It seems the ambient light isnt being used or is not being updated, look at the sides of the hills here, the side that is not facing the sun is always completely black and I can’t see anything. Also, shouldn’t the intensity be full when it is noon? I’ve tried system.out.println on skyControl.getUpdater().getMainColor().toString() on various different hours with getSunAndStars.setHour() and it never gets close to 1f, 1f, 1f, 1f, here is the closest I got when testing (at noon): Color[0.6827515, 0.6827515, 0.6400795, 0.85343933]

Is there any file or texture that your plugin is getting the lighting color throughout the day information from so I can modify it to my liking?

If that picture is taken at noon then how are any sides “not facing the sun”? Looks to me like the sun is pretty low on the horizon.

@8Keep123: The main light color is computed in SkyControl.updateColor() by blending and scaling several color constants. If the sun were directly overhead (sineSolarAltitude=1) then baseColor=sunLight. In the absence of clouds, sunFactor=1 and the main light color will also be sunLight: [0.8, 0.8, 0.75]. However, at the latitude you’ve chosen, the sun is never directly overhead, so it will always be a bit dimmer than that.

If you’re willing to patch the source code, you can give SkyControl.sunLight any value you want. If you do this, you may also need to patch some of the other color constants in SkyControl.java.

If you want the sun to pass directly overhead, you should set a more tropical latitude, such as zero.

I hope that helps.

I set the latitude to 0, now it seems even more dark.

Could it be anything to do with my terrain material?

Here’s my code for that:

[java]
float ice1Scale = 64;

    terrain_mat = new Material(app.getAssetManager(), "Common/MatDefs/Terrain/TerrainLighting.j3md");

    Texture ice1 = app.getAssetManager().loadTexture("Terrain/Snow0086_7_S.png");
    ice1.setWrap(WrapMode.Repeat);
    terrain_mat.setTexture("DiffuseMap", ice1);
    terrain_mat.setFloat("DiffuseMap_0_scale", ice1Scale);
    
    Texture alpha = app.getAssetManager().loadTexture("Terrain/alphamap.png");
    terrain_mat.setTexture("AlphaMap", alpha);

[/java]

It’s just the basic terrainlighting from the examples.

I will manually set the sunlight myself if I can’t resolve this, but I really don’t understand what I am doing wrong in the first place.

@8Keep123 said:

Could it be anything to do with my terrain material?

Easiest way to test that is to put a JME Sphere in the scene with the lighting material and see if it is also overly dark. 5 minutes of testing would at least rule the terrain material setup out or incriminate it.

I tested with a sphere using the jme test data, but its dark too. I guess it isn’t the terrain material, sorry.