Board index FlightGear Development Scenery

Night time

Questions and discussion about enhancing and populating the FlightGear world.

Night time

Postby Zbyszek » Mon Aug 26, 2013 6:52 pm

I don't know what is the current concept of night illuminations in urban areas, but nothing seems to happen there, so I tried to make it myself.
So I've choosed the common way: using night texure/lightmap for creating light spots in towns. It looks quite pleasant. As you can see FlightGear roads aren't illuminated, it's probably easy to do, but notice, that street lamps are mostly just in and around the cities, which can make some troubles.

Image
Zbyszek
 
Posts: 127
Joined: Tue Aug 12, 2008 11:00 am
Location: Poland

Re: Night time

Postby ckruetze » Mon Aug 26, 2013 7:51 pm

It looks really cool, I look forward to flying in the dark.
Zbyszek wrote in Mon Aug 26, 2013 6:52 pm:As you can see FlightGear roads aren't illuminated, it's probably easy to do, but notice, that street lamps are mostly just in and around the cities, which can make some troubles.

If you take the roads from Openstreetmap, you can also take the data about street lights. There is OSM data for individual street lamps, but only about 200.000 of them http://wiki.openstreetmap.org/wiki/Tag: ... treet_lamp.
As an alternative there is also the tag lit with about 670.000 ways that are lit during the night and 170.000 ways that are not lit. http://wiki.openstreetmap.org/wiki/Key:lit

Both the individual lights and the ways often also have data about the light source (gas, electric, ...) so even different levels uf ilumination could be possible.
ckruetze
 
Posts: 32
Joined: Sat Jun 11, 2011 12:06 pm

Re: Night time

Postby Zbyszek » Mon Aug 26, 2013 8:14 pm

I don't think there is really a need for using OSM data. If we write a scrpirt collecting lapms and putting some kind of light as eg. shader on the texture. It would probably cause huge ram usage for the effect, which can be reached using simpler methods.
Zbyszek
 
Posts: 127
Joined: Tue Aug 12, 2008 11:00 am
Location: Poland

Re: Night time

Postby Hooray » Mon Aug 26, 2013 8:38 pm

That looks great, FYI: Back in early 2010, the X-Plane guys wrote a series of blog articles on rendering road networks and cities at night time, including some impressive screen shots - they seem to be using a hybrid approach for close-up scenes, but otherwise also use a more efficient shader-based method:

http://www.x-plane.com/2010/10/version- ... -lighting/
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11569
Joined: Tue Mar 25, 2008 8:40 am

Re: Night time

Postby Zbyszek » Mon Aug 26, 2013 8:51 pm

These used in X-plane are point lights like in our Rembrandt. There are hundreds light sources on the scene (some like cars light are moving) and it seems to working without huge fps impact. See: http://www.x-plane.com/desktop/multimedia/.

EDIT:
Some industrial (town1.png for Europe) and town areas mixed (I've noticed that most city lights have more orange tint rather than yellow (this above is almost greenish).

Image
Zbyszek
 
Posts: 127
Joined: Tue Aug 12, 2008 11:00 am
Location: Poland

Re: Night time

Postby Zbyszek » Wed Aug 28, 2013 4:05 pm

Do you want me to continue this project or you have other idea of night lights (I'm asking some long-term developers)? Currently it's night texure, I don't know how would it looks with lightmap.
Zbyszek
 
Posts: 127
Joined: Tue Aug 12, 2008 11:00 am
Location: Poland

Re: Night time

Postby Thorsten » Wed Aug 28, 2013 5:52 pm

Not sure how in detail you did the picture - we have support for night terrain textures somewhere?

I think the proper way to do it would be to use the functionality of the urban shader effect - that supports some sort of light out of the box and integrates seamlessly into the normal shader framework. Roads could be rendered using urban without a normal map but a lightmap (even moving cars could be done that way using a moving normal map...), and for the other areas with buildings, normal maps could or could not be created.

I'll have a look into this - it looks promising enough. So yes, please continue, let's just talk how to best do this without having to rewrite too many shaders.
Thorsten
 
Posts: 11441
Joined: Mon Nov 02, 2009 8:33 am

Re: Night time

Postby Zbyszek » Wed Aug 28, 2013 6:40 pm

I changed the emissive value and replaced texture file in materials.xml. Is there a way to use two different textures and add <condition> just like we make objects' night illumination?
Zbyszek
 
Posts: 127
Joined: Tue Aug 12, 2008 11:00 am
Location: Poland

Re: Night time

Postby Thorsten » Thu Aug 29, 2013 6:55 am

I changed the emissive value and replaced texture file in materials.xml. Is there a way to use two different textures and add <condition> just like we make objects' night illumination?


Conditionals in materials.xml are evaluated at terrain load time, so I guess it would sort of work to condition on the time just as you can condition on the season or the current position. It's just a bit messy and I wouldn't really want to do it since...

I've looked into the urban effect. This supports an implicit lightmap. The z-component of the normal map is read as emissive strength (well, the b-color channel) and the emissive color is declared in /Effects/urban.eff as <night-color type="vec3d">0.75 0.59 0.05</night-color>. So at night, if the urban effect is on, cities are illuminated with that color where the city normalmap /Textures.high/Terrain/city2-relief-light.png has a blue color value.

Which means that you can illuminate any urban/suburban texture you like by declaring a derived effect which inherits from urban and just changes the color value of the light, and then supplying a normal map which has no r and g color values but just specifies illumination via the b channel. This'd even work for roads I guess.

Now, in order to test this you have to switch random buildings off for the moment because the shader has a conditional not to run when random buildings are on. But we can deal with this later, I can rewrite that to something else if needed.

Maybe you want to play with this idea a bit?
Thorsten
 
Posts: 11441
Joined: Mon Nov 02, 2009 8:33 am

Re: Night time

Postby statto » Thu Aug 29, 2013 1:17 pm

Problem is cities aren't lit up by the continual streams of light as in the picture - for instance the street I live on is fairly dark at night, even though it's near a fairly commercial stretch of roadway. It's the major roads which provide the biggest light sources (along with, oddly enough, parking lots and car dealerships) with isolated points shining randomly in between - most houses are in fairly dark places.

Evidence:
http://www.airliners.net/photo/Rossiya- ... 2305458/M/
http://www.airliners.net/photo/Cessna-1 ... fde4caad85
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2113
Joined: Fri Jan 25, 2008 9:57 pm

Re: Night time

Postby Thorsten » Thu Aug 29, 2013 3:19 pm

But that's a design issue - we can use a different lightmap for landclass roads than we use for roads on a city or suburb texture. It can also be regionally different - the most important thing is to agree on how it's done technically at this point.
Thorsten
 
Posts: 11441
Joined: Mon Nov 02, 2009 8:33 am

Re: Night time

Postby Johan G » Thu Aug 29, 2013 3:43 pm

Do note that the effect probably is a bit less apparent to the naked eye as those photos most probably have had their contrast a bit stretched to give them a bit more of a kick. :wink:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5613
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit


Return to Scenery

Who is online

Users browsing this forum: No registered users and 0 guests