Page 2 of 3

Re: City lights on the dark side of planets

Posted: Sat Sep 09, 2017 11:11 am
by Astrobe
another_commander wrote: Sat Mar 19, 2016 1:29 pm
spara wrote:
Wasn't there something like a shady planet branch or something? Wasn't it supposed to do something like that? What happened to that?
It went stale long time ago and there have been many changes in the planet drawing code and shaders since then, so it may not be such a simple job bringing it up to date.

In any case, I think that shaders would be the way to go about implementing this request. I doubt that flashers or other look-alike effects would be able to cut it.
Almost there (temporary hosting):

Image

The relief in 1.85 with perlin textures is a little bit too strong in my opinion, so I was trying to make it more "flat". I changed the rescale factor from 127.5 to 63.5 at lines 491-493 in OOPlanetTextureGenerator.m. N

However, there are side effects that are more or less welcome (~3MB).

Obviously I don't know what I'm doing. I believe I accidentally flipped the normals for the oceans. Someone more knowledgeable than me about that stuff can probably put it to good use.

Re: City lights on the dark side of planets

Posted: Sun Sep 10, 2017 6:26 pm
by Astrobe
Actually my first goal was to try to mix the old generator and the new generator to obtain landscape features. But it came to me that there may be an easier and cheaper way: use the clouds texture.

Something like: take the clouds texture, keep only the highest values of alpha, and mix it with the ground texture in reverse pixel order (so that the trick isn't too obvious). High alpha values could be use to introduce terrain features with a different color (maybe swap components of the ground color?), low values could be used for city lights. Can someone explain what I've accidentally discovered to me?

Re: City lights on the dark side of planets

Posted: Tue Sep 19, 2017 10:59 am
by Astrobe
After some more reading, trial and error (temp hosting):

Image

This is the dark side of a planet near the dawn line; one can see a bit of the lit part in the bottom right corner. The bright dot on the left is a star, the other isolated points are space dust.

I targeted the coastlines to make tests more easy, so it looks a bit ugly and silly (actually on this picture the criteria was still including water bodies). As far as I understand it, I indeed flipped the depth coordinate of the normal vectors (Z in [0..128] instead of [128..255]).

The downside is that the brighter the point is on the dark side, the darker it will appear on the lit side. So it looks terrible especially on the coastlines which are normally pale, but I think it's still usable for cities which can be dark patches. Maybe it will be possible to mitigate this by picking a bright color for them.

Re: City lights on the dark side of planets

Posted: Thu Sep 21, 2017 3:15 pm
by Astrobe
I give up. The glow is too faint on the dark side and it looks horrible on the light side no matter what, and it doesn't look like cities anyway.

I guess we will have to wait for shader gurus to pick it up. I think the way to go would be something like:
1. Create predefined city patterns textures with associated shaders,
2. Pick a bunch of them pseudo-randomly and superpose them,
3. Apply the texture generator on top of that map to get relief, oceans, specular lighting etc.

Or maybe run the texture generator first then apply the city textures on top of it.

Re: City lights on the dark side of planets

Posted: Thu Sep 21, 2017 11:55 pm
by phkb
Sometimes things work out, and sometimes they don't, but we won't know until we try. Thanks for your work on this, even though it didn't work out the way you wanted. Well done.

Shader gurus .. over to you!

Re: City lights on the dark side of planets

Posted: Sun Sep 24, 2017 5:04 am
by Commander_X
<popping in, while still waiting for the gurus>

Not that difficult with the shaders. Tweaking the parameters for the noise now, _that_ will be a challenge.

Image

The noise looks a bit better in game, it twinkles[*] ;)

*Which of course is an unexpected "feature".

Re: City lights on the dark side of planets

Posted: Sun Sep 24, 2017 8:30 am
by another_commander
Interesting. Looks nice. What happens when the cloud layer is over the lit areas? Do they get temporarily hidden or dimmed while the clouds pass over them?

Re: City lights on the dark side of planets

Posted: Sun Sep 24, 2017 10:55 am
by Astrobe
Commander_X wrote: Sun Sep 24, 2017 5:04 am
Not that difficult with the shaders. Tweaking the parameters for the noise now, _that_ will be a challenge.
How did you do that? Is this the mysterious "shady planet" branch Spara was talking about earlier?

Re: City lights on the dark side of planets

Posted: Sun Sep 24, 2017 4:43 pm
by Commander_X
another_commander wrote: Sun Sep 24, 2017 8:30 am
What happens when the cloud layer is over the lit areas?
Astrobe wrote:
How did you do that? Is this the mysterious "shady planet" branch Spara was talking about earlier?
Trying to answer both questions at once: it's done through the trunk planet fragment shader, only. Thus, the clouds obscure this.

Re: City lights on the dark side of planets

Posted: Mon Sep 25, 2017 4:37 pm
by cbr
This all looks very nice, does it have some twink'ling too?

Re: City lights on the dark side of planets

Posted: Tue Sep 26, 2017 11:52 am
by Astrobe
Commander_X wrote: Sun Sep 24, 2017 4:43 pm
Trying to answer both questions at once: it's done through the trunk planet fragment shader, only. Thus, the clouds obscure this.
Sorry, is it a branch in the oolite github repo or is it in a separate repo?

Re: City lights on the dark side of planets

Posted: Tue Sep 26, 2017 2:08 pm
by Commander_X
Astrobe wrote: Tue Sep 26, 2017 11:52 am
Sorry, is it a branch in the oolite github repo or is it in a separate repo?
It's on my computer at the moment. I can provide the simple changes (given my -- rather slow -- release cycle tendencies) but I'd rather not pollute the forum with potentially dangerous, definitely not polished and very likely shameful code :oops: .
I guess PM for the adventurous shouldn't be a problem, though.

Re: City lights on the dark side of planets

Posted: Thu Sep 28, 2017 2:12 pm
by Astrobe
Commander_X wrote: Tue Sep 26, 2017 2:08 pm
It's on my computer at the moment. I can provide the simple changes (given my -- rather slow -- release cycle tendencies) but I'd rather not pollute the forum with potentially dangerous, definitely not polished and very likely shameful code :oops: .
I guess PM for the adventurous shouldn't be a problem, though.
Yes, please! You can PM them to me as diffs/patches if that's easier for you.

Re: City lights on the dark side of planets

Posted: Thu Sep 28, 2017 5:44 pm
by Commander_X
Astrobe wrote: Thu Sep 28, 2017 2:12 pm
Yes, please! You can PM them to me as diffs/patches if that's easier for you.
Done. There are some changes that mainly modify the pattern the lights are spread (to avoid the potato distribution :) )

For reference, this is what Lave should look like when launching a new Jameson:

Image

Re: City lights on the dark side of planets

Posted: Fri Sep 29, 2017 11:17 pm
by cbr
while ring month fades away, city lights awaits... :)