Board index FlightGear Development Effects and shaders

ALS traffic shader -artwork needed

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

ALS traffic shader -artwork needed

Postby Thorsten » Wed Mar 08, 2017 8:28 am

As already announced elsewhere, I've been busy over the last days coming up with a support effect for the OSM2City generated detailed roads. This actually is pretty neat now and should cover most cases in terms of configurability.

Here's how it looks at the moment - cars are basically painted as simple blocks, the shader just assigns a random color, the headlights are procedurally generated as lightmaps. Since this is Scandinavia, we keep headlights on during the day, I'll add an option to have them off when it's light for other parts of the world.

Image

At night you get road illumination and traffic density modulated by road type - there's less traffic on secondary roads. Also car speed varies, it's usually faster on the main roads.

Image

If you start to increase traffic density, it'll slow down where it gets heavy, eventually grinding to a halt on the highway whereas it continues to run on the secondary roads (looks a bit nicer on video...)

Image

The effect Effects/road.eff is on FGData but won't do anything because currently the OSM2City generated data doesn't request it - so to see anything, the effect requested for roads needs to be patched to ask for the new one.

With the traffic patterns running more or less, I could use some help from texture artists. What can be done is to render car images from above rather than the generic blobs - for that I'd need such pics on a strip (pretty much like we do for trees).

What can also be done is that if we can get heightmaps for the cars, we can render them mock 3d (pretty much like the urban shader effect generates a relief from the urban textures) - that won't hold from close distance, but look sort of okay from higher up.

Also, at this point some input on what ought to be configurable where (runtime/design time/hard-coded/...) would be good.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby CaptB » Wed Mar 08, 2017 8:54 am

Rendering a basic vehicle from above is not a big deal, but I'm a little bit lost how you want the layout on the .png, confirm something like savanna-tree.png , 4 images for the same vehicle in a column, each column for a different car image?
Ongoing projects(3D modelling): A320, MD-11, A350, B767
FG767: https://fg767.wordpress.com/
CaptB
 
Posts: 685
Joined: Thu May 23, 2013 7:36 pm
Callsign: EKCH_AP
IRC name: CaptB
Version: next
OS: Xubuntu

Re: ALS traffic shader -artwork needed

Postby Thorsten » Wed Mar 08, 2017 11:26 am

Pretty much like one line of trees (savanna-tree.png being just one example - the trick with trees is that they also come in four columns to simulate seasons, and we don't need that) - getting eight different shapes is probably better than just four - we can always stretch runtime if needed.

So ideally 8 car images of 1:2 aspect ratio on a texture strip (which then has 4:1 aspect ratio). it's not terribly important in detail, I know how to re-arrange images on a sheet once I have them.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby Johan G » Wed Mar 08, 2017 11:30 am

Something I miss a little in the above screenshots are the (admittedly weaker) tail lights. Still looks like a good beginning of a nice feature. :)
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: ALS traffic shader -artwork needed

Postby CaptB » Wed Mar 08, 2017 12:22 pm

is this sort of a vehicle enough or do you need something more detailed?

Image
Ongoing projects(3D modelling): A320, MD-11, A350, B767
FG767: https://fg767.wordpress.com/
CaptB
 
Posts: 685
Joined: Thu May 23, 2013 7:36 pm
Callsign: EKCH_AP
IRC name: CaptB
Version: next
OS: Xubuntu

Re: ALS traffic shader -artwork needed

Postby bugman » Wed Mar 08, 2017 1:17 pm

@Johan, that might be a bit tougher! Having white on one side and red on the other. You'd then also maybe need a few yellow headlights for France. Then for the UK, Japan, Australia, NZ, India, Pakistan, the southern end of Africa, most of SE Asia, and all of the ex-British colonies you'd need to reverse the white and red lights for driving on the left hand side:

Image

Regards,
Edward
bugman
Moderator
 
Posts: 1808
Joined: Thu Mar 19, 2015 10:01 am
Version: next

Re: ALS traffic shader -artwork needed

Postby Thorsten » Wed Mar 08, 2017 1:22 pm

I guess once we're reading a (small) texture, we might as well cram as much detail into it as the texture can hold.

Also, greyscale image is fine, because the shader supplies color already (we could probably encode the glass areas in the alpha channel and pass it to the reflection map for added effect...)

I don't have any strong preferences how it ought to look like, I suspect the distance range in which you can already see car outlined, but you aren't bothered by the fact that it's flat is not that huge. So far, I've been ufo-testing this, I'm not sure how a normal flight pattern shows it.

From high above all you see is a moving dot.

Having white on one side and red on the other. You'd then also maybe need a few orange headlights for France. Then for the UK, Japan, Australia, NZ, India, Pakistan, the southern end of Africa, most of SE Asia, and all of the ex-British colonies you'd need to reverse the white and red lights for driving on the left hand side.


That's actually not a problem - because it's a procedural shader, reversed traffic direction is just a sign flip and adding tail lights is just adding another draw command - the main reason I've not done it is that unlike the headlight illumination of the ground, you wouldn't actually see tail lights when the car drives towards you, but for a flat object it's not trivial to suppress.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby bugman » Wed Mar 08, 2017 1:27 pm

From memory, in the morning and late afternoon, it's the car's shadow that is the most obvious optical component when in the air. Something to think about ;)

Regards,
Edward
bugman
Moderator
 
Posts: 1808
Joined: Thu Mar 19, 2015 10:01 am
Version: next

Re: ALS traffic shader -artwork needed

Postby CaptB » Wed Mar 08, 2017 2:26 pm

@Thorsten

Here's a more detailed version, any more elements will probably not be visible anyway in flight, also, not sure how would you want it lit so that it does not look artificial in the sim. Should there be more types of cars? like lorry, truck etc?

Image
Ongoing projects(3D modelling): A320, MD-11, A350, B767
FG767: https://fg767.wordpress.com/
CaptB
 
Posts: 685
Joined: Thu May 23, 2013 7:36 pm
Callsign: EKCH_AP
IRC name: CaptB
Version: next
OS: Xubuntu

Re: ALS traffic shader -artwork needed

Postby Thorsten » Wed Mar 08, 2017 3:23 pm

Here's a more detailed version, any more elements will probably not be visible anyway in flight, also, not sure how would you want it lit so that it does not look artificial in the sim. Should there be more types of cars? like lorry, truck etc?


It'll work.

More car types are definitely desirable, but they need to fit onto the same space - the shader won't have uv-mapping available, it will just read same sized chunks of texture. So the largest car type determines relative sizes (just like for the trees).

WRT colors - my earlier suggestion to encode glass in alpha ain't working because we need alpha for the outline. So another scheme would be to use the red channel to encode grey values and the green channel to encode glass parts.

not sure how would you want it lit so that it does not look artificial in the sim


Assume diffuse blue-grey light coming from the sky hemisphere - that'll always be the case. We can mock up direct light effects later as needed.

it's the car's shadow that is the most obvious optical component when in the air.


That's a toughie, because the shadow might be outside the road polygons.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby wlbragg » Wed Mar 08, 2017 4:20 pm

Slight bit off topic, how do the OSM roads behave when over top of the ws2.0 (OSM) road that might happen to be laid down underneath it?
Are they lining up to where the underlaying road isn't showing or are we getting weird overlaps showing?
What is the difference as far as the shader is concerned between using it on the new generation of OSM road addition VS the ones in ws2.0?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7587
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: ALS traffic shader -artwork needed

Postby Thorsten » Wed Mar 08, 2017 4:24 pm

'Normal' roads are part of the terrain mesh, OSM roads are 3d models arranged on top of the terrain mesh. They behave pretty much like any 3d model on top of the terrain - they usually are over the normal road, except sometimes not, and rarely there's z-fighting where the mesh happens to be co-planar and non-separated.

The difference in shader is that OSM roads use a variant of the model shader because they deal with an uv-mapped 3d model, normal roads use a terrain shader because just like most of the terrain mesh they do not have uv-mapping.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby wlbragg » Wed Mar 08, 2017 4:45 pm

Thanks.

Do we know if the OSM model roads are the future of our scenery?
Is that the plan to use them this way with Pete's work and eliminate the terrain mesh roads?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7587
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: ALS traffic shader -artwork needed

Postby Thorsten » Wed Mar 08, 2017 4:51 pm

I don't think anything has been decided.

The shader techniques however will work on anything uv-mapped, even if that is part of the mesh.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby CaptB » Wed Mar 08, 2017 9:46 pm

Three versions so far, a city hatchback, pickup and a lorry.

Image

Image

Image
Ongoing projects(3D modelling): A320, MD-11, A350, B767
FG767: https://fg767.wordpress.com/
CaptB
 
Posts: 685
Joined: Thu May 23, 2013 7:36 pm
Callsign: EKCH_AP
IRC name: CaptB
Version: next
OS: Xubuntu

Next

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 3 guests