SevenSky - physically based sky rendering library


#21

to earlier: no i mean that i need to remove processor before adding lightFilter from sevenSky to this filter processor to make it work.

  1. btw i also had some artifacts on sky, like white lines generating from clouds, it was looking like some Seam of texture?

its only when i look up

  1. Also it would be nice to get some extended usage documentation :slight_smile:

  2. so i understand this is Bsd if i dont use additional libraries like src-nuta and src-vsop


#22

@oxplay2 I see, so if you do not remove it, then what happens? black pixels like for @Ali_RS? Does the issue happen also if you run TestSky?

  1. yes, I’ve also noticed slight seams, although the weather map should be seamless, will have to debug this to find out where they come from.

  2. Yes, extended doc would be nice, for now you can check out the dissertation/ask questions.

  3. Yes the library is BSD, and yes the additional libraries have different licences.


#23

I found why i had black bottom.

Try add any filter processor before adding skySeven processor.

like (in example TestSky):

	FilterPostProcessor fpp2 = new FilterPostProcessor(getAssetManager());
            
            FogFilter fog=new FogFilter();
            fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f));
            fog.setFogDistance(400);
            fog.setFogDensity(0.2f);
            fpp2.addFilter(fog);
	getViewPort().addProcessor(fpp2);
            
	getViewPort().addProcessor(skySeven);

When

getViewPort().addProcessor(skySeven);

is on top of it, only then it work.

So this looks like Processor order is important here?

screens:


#24

Key 5 is not mapped to anything.
Not clear for me how should I rotate it.

I add the following one , but nothing happens

key(KeyInput.KEY_5, new AnalogListener() {
		@Override
		public void onAnalog(String name, float value, float tpf) {

                            WeatherMapGenerator.WeatherMapData data = vars.get(Clouds.WeatherMap);
                            WeatherMapGenerator.rotate(data.clouds, 0.05f);
		}
	});

PS: The result I want is exactly the sky in bottom right side.

Do you have weather map for that one ?

I tried the clouds with different parameters for Scattering, Coverage, DetailScale , … but could not reach the similar result.

Will appreciate if you can please provide sky/cloud/stars/planet parameters you have used for creating the above skies.

Edit 1:
I just realised you pushed the rotation code to TestSky in github page, tested it and works like charm! Thank you so much @The_Leo


#25

@oxplay2 Thanks, now I can replicate that, yes it seems that the order indeed matters. Not sure if it can be made order independent, since the SevenSky processor should render before the LightFilter.

@Ali_RS Well, the first and last, do not render high altitude clouds, disable high altitude clouds by setting

vars.put(Clouds.AltoCoverage, 1f);

The rainbow is rendered by setting RainDensity parameter, (currently its more like rainbow brightness), i don’t remember the exact value eg try:

vars.put(Clouds.RainDensity, 70000f);

The second picture shows a sun close to the horizon. You can either set the sun direction directly of compute it based on time as shown in TestSky.

skySeven.setSunDir(SunDir);

Finally for the night sky, I suppose I better prepare a test case for that one.
Regarding the weather map, if I remember correctly, all should be using the default test weather map.


#26

Thank you @The_Leo
Previously I was getting very small clouds scattered all over the sky but with weather map rotation code you added to TestSky I can now get very nice clouds similar to what you can see in image.

Regarding night , yes i think it deserves a test case.
I will wait until the test is ready.


#27

@The_Leo

is there also a way to make clouds “less blurry”?

i were playing arround vars(like DetailScale etc), and found Clouds.Scattering or make them lesss blurry, but not sure if i should use it.

btw. it would be nice to have all vars explained.

also about this seams, please see screenshot, it looks like it have 2 seams.

Please note i use vars from earth. recently added WeatherMapGenerator rotation you said, but seems it have some conflict, because it work only when i pause game, but is in same update method as moving clouds, so its odd… will investigate later.


#28

@oxplay2 After playing with it a bit, I think the there might be a bug in the weather map update, it looks as if its not seamless. I’ll give it a closer look tomorrow.

The vars are currently explained in the dissertation, in the API chapter. Documentation in the code is to be added. Increasing scattering will make the clouds look denser, thus less blurry. I have also a test case which has all the sliders for these parameters, I just have to convert it, since it uses the code before it was refactored.


#29

im not sure, because when i show first seam bug, then i had a previous version before 27.10.2018 update.


#30

I’ve been tinkering with this a bit and quite liking it. However, there’s some trouble with gamma correction.

Enabling the gamma correction setting is critical for PBR render (and really should be used anyway), and my system uses PBR so disabling gamma correction really is not an option. However, with gamma correction enabled, the sky is washed out and too bright. I’ve taken a look through the SevenSky code to see what I can dig up, but no luck so far. @The_Leo, any ideas on this?


#31

SevenSky uses custom gamma correction in order to achieve how it looks.

This has been fixed now and it should no longer happen, the SevenSky gamma correction should now be independent from jme’s one. :slightly_smiling_face:

Three new keys have been added to SevenSky.LightFilter, namely: TONE_MAP_SCALE, TONE_MAP_FROM, TONE_MAP_TO

Instead of explaining them here is the tonemapping function currently used, default values are 4.0, 0.0, 1.0

vec3 tonemap(vec3 c) {
    float range = m_ToneMapTo-m_ToneMapFrom;
    c = (c-m_ToneMapFrom)/range;
    return 1.0-exp(-m_ToneMapScale*c);
}

#32

Thanks! That was fast. :wink:

It’s a lot better, but still too bright compared to the “ground truth” without gamma correction enabled. Do you have any resources regarding matching the tone mapping parameters to the physically correct appearance?


#33

To get it darker you can try tweaking TONE_MAP_SCALE, the default value is 4.0.
Btw, what is physically correct appearance? You can calculate the irradiance etc by using equations and get reasonably close approximations. However to show it on monitor we have to map it to 0-255 range of RGB. Furthermore, visual increase in irradiance does not go hand in hand with the perceived increase of brighness. That’s why we have tonemapping. Now, there are plenty of tonemapping functions and also articles about it you could search.


#34

Poor choice of words on my part - since you have it rendering based off of physical phenomena, I was referring to getting it to match the sky appearance when gamma correction is turned off - i.e., the color the sky would be with no tone mapping corrections applied.


#35

To see how it looks without tonemapping, simply change the tonemap function to return the color, i believe it is in the post.frag shader. There is also a screen shot of how sky looks without tonemapping in the dissertation (on page 41).


#36

Ok, I’ll try that. Thanks!


#37

@The_Leo would you mind add a test case for night sky, please. :slightly_smiling_face:


#38

@The_Leo

i like this lib, but i had stopped using it because i had problem with envmap(lightprobe) not seeing this skybox, while standard ones were visible. i just had color, no sky in this envmap texture.

was it maybe fixed already?

also it was too much “blur” for me.


#39

I wanted to do this, but then I put it off for later, sorry. There’s little bit of work to do: add moon/planets to test case, rewrite Stars to use instancing, and add ambient skylight (eg. when there is neither sun nor moon in sky). Well, eventually I’ll get it done. They’re not big tasks, just got to get back to this. i’ll try to get it done by this week.

What code did you write to attempt it to work with Jme3 lightprobes? I haven’t used jme’s lightprobes yet, but as long as you can load a texture as a sky map you should have no problems. You can generate sky 360 view texture with the use of SkyLutGPUGenerator/SkyLutGenerator.
It’s best if you first save the generated texture to disk and get it to work, then later you can do it at runtime.

What was blurry? Clouds or sky?


#40

environmentCamera generate 360 view texture for lightprobe that contains everything, not just skybox. i think i could mix it somehow, but the best would be is it would just work. please just try lightprobe envmap and see yourself if it work, last time i checked it, it was not working.

What was blurry? Clouds or sky?

Clouds, where clouds are trully most of sky… i tried a lot of different configuration, but nothing helped. It looks nice, but its too much blurry. Also i had this seams, did you tried fix it?

Anyway main problem is lack of examples i think, because i could miss some configuration setting and i dont had time to analyze all code to see what need to change.(and how much / what values - some params were very sensitive)