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!

Re: ALS traffic shader -artwork needed

Postby vnts » Thu Mar 09, 2017 12:11 am

Thorsten wrote in Wed Mar 08, 2017 1:22 pm: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...)

Vehicles can have non-specular areas belonging to trailers/hoods/wheels/bumper/etc that stand out from metallic, window & light glassy surfaces. Perhaps tagging in a channel would work with those as well. Tagging 4 different sides might allow rough shading. Tagging for a secondary colour might be appropriate on big non-car vehicles - like stripes/markings (could be randomly turned off by setting to primary colour).
Thorsten wrote in Wed Mar 08, 2017 8:28 am:Also, at this point some input on what ought to be configurable where (runtime/design time/hard-coded/...) would be good.

Congestion / traffic could be seen to vary depending on weekday/week end/time of the year/festivals, or might be very low away from population centers. A runtime override to regional definitions might end up being used?

The small insignificant digits of the same random number used to determine vehicle presence in a domain could possibly be used, without correlation problems, to control the percentage of different types of vehicles on different types of road (e.g. more trucks on larger motorways). (Lack of roads on nightly builds, but from following the math/logic in road shader instead). Vehicle frequencies would vary from region to region.

I guess it could be done manually, but an option to automatically turn off when the illusion is completely broken might be convenient (at night time it probably matters less).

Not sure it's worth performance hit of having an extra branch, or is possible, but perhaps relaxing lighting at large distances so headlights flatly light the whole street at night might stop (possible?) flickering at low lod due to points being sampled, or simulate very small relatively bright sources being visible. From far away there would be bright points moving back and forth through each other.
Thorsten wrote in Wed Mar 08, 2017 3:23 pm:
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.

Perhaps (?) lack of shadow won't be noticeable if shadows were faded out as they get really long. Perhaps lack of shorter day time shadows on adjacent material won't be noticeable - because grass etc. reflects less and is less uniform (maybe cars closer to one edge can get away with not casting shadows at all). Then again, maybe there is just no way around it in current scenery format (until transition metadata is available).

The occluded space underneath cars stands out a bit from the road and shiny car at shallower angles, as well.

Perhaps a strip of the image at the boundary of the texture can be interpreted as relative height of the occluder that casts the shadow (e.g. lengthwise profile is 2x higher in the middle section of a car than at ends). It does create problem towards the back/front of the car at lower sun angles where the high midsection casts the shadow. Data in the other two channels could reference midsection height and ratio of depth of bonnet/boot to midsection height-boot height, or the midsection height could be read at an appropriate place for low sun angles. There probably isn't an easy solution.
CaptB wrote in Wed Mar 08, 2017 9:46 pm:Three versions so far, a city hatchback, pickup and a lorry.

Looked at SVGs on public domain clip art, but it seems you are modeling it in 3d, which is better as a heightmap could be extracted. Looks good.

Kind regards,
vnts
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

Re: ALS traffic shader -artwork needed

Postby gsagostinho » Sun Oct 14, 2018 1:22 am

Hi Thorsten, apologies for resurrecting this old post but do you still need textures for the cars? I would be happy to make some. I tried looking for the current textures in FGData but I could not find them, could you please point me to where they are?
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: ALS traffic shader -artwork needed

Postby Thorsten » Sun Oct 14, 2018 5:16 am

It's currently texture-less, the cars are drawn by evaluating a function - which we could change if we had textures 8)
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby gsagostinho » Sun Oct 14, 2018 1:52 pm

Great, I will work on a sheet with car textures and send it to you as soon as I have something. Should I also create a lightmap variation of this sheet similarly to the textures on FGDATA/Textures/osm2city? And if so, what channels should I use for the forward yellow lights and red back lights? Or do you prefer to only have the car textures and handle the lights in a different way?
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: ALS traffic shader -artwork needed

Postby Thorsten » Sun Oct 14, 2018 2:11 pm

I'm... not sure. Maybe we just start with car textures and see whether something is required in addition? Assuming you're willing to go through a few iterations - I haven't worked out all the details myself yet...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby gsagostinho » Sun Oct 14, 2018 2:26 pm

Sounds good, and I don't mind to go through as many iterations as necessary.
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: ALS traffic shader -artwork needed

Postby gsagostinho » Sun Oct 14, 2018 4:34 pm

Thorsten, this is my first try:

Image

Link: https://i.postimg.cc/yNRvH725/cars.png

I used a grid of 32 x 128 pixels per car as to be able to accommodate trucks and buses as well. Let me know if I am on the right track.
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: ALS traffic shader -artwork needed

Postby Thorsten » Sun Oct 14, 2018 5:47 pm

It looks nice - I'll give it a try (might be a few days though I hope we can clear the release soon, but right now it has priority...)
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby gsagostinho » Sun Oct 14, 2018 6:07 pm

Great, let me know if you need any other changes, and no rush. Cheers!
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: ALS traffic shader -artwork needed

Postby Hooray » Sun Oct 14, 2018 7:04 pm

This could look really neat, especially if this could be made to work in conjunction with FredB's original Urban/relief shader approach to give vehicles an appropriate shape.
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: ALS traffic shader -artwork needed

Postby Thorsten » Sun Oct 21, 2018 3:42 pm

This kinda works...

Image

... except it still has quirks (probably my fault) and I need an idea how to place head/tail lights correctly...

And sometimes they drive really close behind each other...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: ALS traffic shader -artwork needed

Postby legoboyvdlp » Sun Oct 21, 2018 3:44 pm

Then you need a police car to pull over the tailgater :mrgreen:
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: ALS traffic shader -artwork needed

Postby vanosten » Mon Oct 22, 2018 9:08 am

Cool. Once I am done with the testing of populating osm2city with plausible buildings where there are no OSM buildings, I might look at the glitches in roads again.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 540
Joined: Sat Sep 25, 2010 6:38 pm
Location: Denmark - but I am Swiss
Pronouns: he/his
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: ALS traffic shader -artwork needed

Postby gsagostinho » Mon Oct 22, 2018 7:27 pm

@Thorsten That is looking good, thanks for taking a look at this!

About the lights, what if I make a mask with front and back lights on it? For instance, we could have the rear lights in the red channel and the front lights in the blue channel. This could (in theory) allow the front and back lights to be switched on and off separately, for instance according to the angle to the viewer (so that we get red lights on one side of the road and yellow lights on the other). Do you think that's possible?

As for the collisions, I can move the car textures to the centre of the 32 x 128 pixel slot, and then if this whole slot is mapped in the game into a single rectangle object of same size regardless of the car texture then it might help with collisions. Something like this:

Image

Image

Image
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: ALS traffic shader -artwork needed

Postby Thorsten » Tue Oct 23, 2018 6:58 am

You seem to be reading my thoughts... After thinking about lights, I was going to propose the following:

* move to a square texture sheet to give us two rows with more space back and front for the lightmaps (this likely will also improve car spacing)
* supply a second sheet with metadata, on which (for the same car positions) we'd have

- 1 color channel for the illumination of head and tail lights on the ground (not really changing with view angle)
- 1 color channel for the lightspots themselves for head and tail lights (changing with view angle - we already have the code, and we can use the position on the texture sheet to tag what is headlight and tail light if the cars are in the center of each row)
- (1 color channel for a heightmap so we could try to give some 3d appearance to the cars (?)

That would leave us 1 color channel free in case we feel at some point we need something more (a dirt overlay for cars off the main roads perhaps?)

How does that sound?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests