New SkyControl releases


#81

so, how to solve your problem in the result?


#82

Are you asking me? Or Thoced?


#83

sorry, I asked @thoced :slight_smile:


#84

Hello,

Using the update of Skycontrol 0.9.12


#85

Version 0.9.13 of SkyControl is now ready. The old SkyControl constructor is now deprecated, as promised.


#86

Sorry for bumping this thread

@sgold any way I can use SkyControl with PBRLighting ?


#87

Sorry, SkyControl is not compatible with PBR—or even with gamma correction.

SkyControl has been in a holding pattern for over a year now. I haven’t even rebuilt the library for JME v3.2.3 yet!

By the way, the current release is v0.9.17 .


#88

I was able to make it work in my PBR scene using the solution provided here:

I am updating FilterColor with AmbientColor value getting from SkyControl.

Here is my code in case anyone interested

    /**
     * Wrapper state for SkyControl
     *
     * @author Ali-RS
     */
    public class SkyState extends BaseAppState {

        private TimeOfDay timeOfDay;
        private SkyControl sc;
        
        private final Vector4f pbrAmbient = new Vector4f(1, 1, 1, 1);
        private final MatParamOverride overrideFilterColor = new MatParamOverride(VarType.Vector4, "FilterColor", pbrAmbient);;

        public SkyState() {
        }

        public TimeOfDay getTimeOfDay() {
            return timeOfDay;
        }

        public SkyControl getSkyControl() {
            return sc;
        }

        @Override
        protected void initialize(Application app) {
            this.timeOfDay = new TimeOfDay(9);
            app.getStateManager().attach(timeOfDay);
            
            LightingState lightingState = getState(LightingState.class, true);

            sc = new SkyControl(app.getAssetManager(), app.getCamera(), 0.7f, StarsOption.Cube, true);
            Node rootNode = ((SimpleApplication) app).getRootNode();
            rootNode.addControl(sc);
            
            sc.setSunStyle("Textures/skies/suns/hazy-disc.png");
            sc.setCloudiness(1f);
            sc.setCloudsYOffset(0f);
            //sc.getSunAndStars().setObserverLatitude(0.2f);
            //sc.getUpdater().setMainMultiplier(2f);

            sc.getUpdater().setAmbientLight(lightingState.getAmbientLight());
            //sc.getUpdater().setMainLight(lightingState.getSun());

            String Clouds_L = "Textures/skies/Clouds_L.png";
            sc.getCloudLayer(0).setTexture(Clouds_L, 1f);
            sc.getCloudLayer(1).setTexture(Clouds_L, 1.5f);

            sc.setLunarDiameter(FastMath.DEG_TO_RAD * 8);
            sc.setSolarDiameter(FastMath.DEG_TO_RAD * 7);
            
            sc.setPhase(LunarPhase.FULL);

            int numSamples = app.getContext().getSettings().getSamples();
            BloomFilter bloom = Misc.getFpp(app.getViewPort(), app.getAssetManager(), numSamples)
                    .getFilter(BloomFilter.class);
            if (bloom != null) {
                sc.getUpdater().addBloomFilter(bloom);
            }
        }

        @Override
        protected void cleanup(Application app) {
            app.getStateManager().detach(timeOfDay);
            sc.getSpatial().removeControl(sc);
            timeOfDay = null;
            sc = null;
        }

        @Override
        protected void onEnable() {
            sc.setEnabled(true);
            sc.getSpatial().addMatParamOverride(overrideFilterColor);
        }

        @Override
        protected void onDisable() {
            sc.setEnabled(false);
            sc.getSpatial().removeMatParamOverride(overrideFilterColor);
        }

        @Override
        public void update(float tpf) {
            sc.getSunAndStars().setHour(timeOfDay.hour());
            ColorRGBA color = sc.getUpdater().getAmbientLight().getColor();
            pbrAmbient.set(color.r, color.g, color.b, color.a);
        }
    }