Board index FlightGear Development Effects and shaders

Night Vision

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

Re: Night Vision

Postby planetacancun » Thu Mar 03, 2011 11:49 pm

The Rafale B has some night vision with the HUD:

Image
Callsign:Fallen-
Videos: http://youtube.com/planetacancun2
planetacancun
 
Posts: 322
Joined: Thu Jul 30, 2009 5:52 pm
Callsign: Fallen-
IRC name: Fallen-
Version: GIT
OS: Ubuntu

Re: Night Vision

Postby HHS » Thu Mar 03, 2011 11:56 pm

TYothers wrote:
1) First off, I'm a bit confused by the Effects and Shaders interface. I've yet to find out how models utilize an effect. Certainly, the "tree.eff" effect isn't applied to everything. Is this somehow setup in the tree models to the effect name ("Effects/tree")? I at least noticed that in "materials.xml" the Ocean material has an effect property set to "Effects/water", so that certainly is how materials handle it.



tree.eff is an effect file wich refers to the shader.
An .xml must include the link to this effect-file to show the shader. Here it is in the materials.xml

Shader.frag, Shader.vert --> .shader.eff --> .xml

All other questions will be maybe answered in data/Docs/README.effects.
If any further questions left please ask on the devel-list, as your request goes more into hard coded things, than really shaders.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Night Vision

Postby jack » Fri Mar 04, 2011 6:44 pm

Nice! If this goes well I might look into putting it in the AH-1!
For Military Aircraft, Scenery, and more, visit http://alphashangar.co.nr/

'Retired' from FlightGear as of July 2011. You can contact me via my website if you'd like to pick up any old projects.
jack
Retired
 
Posts: 1432
Joined: Wed Mar 03, 2010 12:26 am
Location: KLVK
Callsign: Alpha-J, Rescue1
Version: GIT
OS: Mac OS X

Re: Night Vision

Postby HHS » Fri Mar 04, 2011 8:58 pm

TYothers wrote: It looks like I may have to make more drastic edits and possibly change code to implement more. Any ideas?


Wow- that looks already great! :D
I think it is still a good idea to ask on the devel-list. Our graphic specialists don't use this forum too often, so you will get better answers there!
-->http://wiki.flightgear.org/index.php/Mailing_list
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Night Vision

Postby HHS » Fri Mar 04, 2011 9:27 pm

TYothers wrote:I appreciate the compliments!

HHS>> I will do just that. I once asked a question there and didn't get a response, and have had trouble getting FlightGear to compile, so I was a little hesitant. Time to suck it up and try again with these new questions!


Yep, that happens unfortunately from time to time. :(
But if you show your work already done, there is a chance.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Night Vision

Postby Gijs » Sun Mar 06, 2011 11:36 am

You can edit the dome color via sim/scene/dome (or sim/scene/sky, cannot check right now). Which will give you something like this (yes, I was trying to create a polar light effect) and by editing the other setting (sky or dome, not sure which one) land/model color will change. IIRC you do have to pause the sim, else the numbers get overwritten.

This is not the right way to do it, it should be done via some internal script of course, but it'll allow you to easily test color settings ;)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9549
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Night Vision

Postby Ernest1984 » Sun Mar 06, 2011 11:49 am

I think the sky should stay as it is - dark (it is how it looks in the NV googles).
It looks great already :)
EPWA-hub: ERJ-195 clsgn: ERNIE
-----------------------------------
Around The World with B1900D!
callsign: AROUNDw - currently suspended till the FG will have a proper look on different locations
User avatar
Ernest1984
 
Posts: 438
Joined: Wed Dec 01, 2010 4:47 pm
Location: Poland / Canada
Callsign: ERNIE
Version: 2.10
OS: Mac OS X 10.8.2

Re: Night Vision

Postby Zan » Sun Mar 06, 2011 11:04 pm

TYothers wrote:1) First off, I'm a bit confused by the Effects and Shaders interface. I've yet to find out how models utilize an effect. Certainly, the "tree.eff" effect isn't applied to everything. Is this somehow setup in the tree models to the effect name ("Effects/tree")? I at least noticed that in "materials.xml" the Ocean material has an effect property set to "Effects/water", so that certainly is how materials handle it.

Terrain effects are set in materials.xml, models may define their own effects inside their .xml files, and some effects are hard coded in the source. For example trees and clouds use a hard coded effect path. Skydome and 2d clouds iirc do not use any shaders.

Basically there is no way to define an effect that could be used everywhere (at least since soem elements do not use those at all...). Might be possible to do some kind of hack though.

2) Also, what is the purpose of 'n' in this statement:
Code: Select all
  <technique n="10">


Effects can be inherited, so that the effect on top is selected if all it's conditions are true, or if not, one below it will be used. The n number in technique tells the order in which the techniques are tried. I don't remember if smaller or larger number are tried first.

Basically you could inherit your shader from some other shader and add a condition for the night-vision-enabled, and by selecting a proper n order for your shader, it would override the default shader when night vision is enabled.


3) Additionally, what happens if you do not wish to set a value and omit it in an effect file? Must all values be set? Would you inherit from the "model-default" effect to do this or is there another methodology?

If the effect is inherited, I think you only need to define the parameters you want to change. Not sure about this though.

4) Finally, I'm willing to take suggestions on the implementation of this.

I'd say an effect like this should be a post-process effect, so that you first render the scene normally and then apply a full-screen effect that changes the colors and adds noise and whatever. This would probably need HDR rendering so that the darkest colors could be amplified, and the post processing system is not yet properly implemented in fg.

HTH, Zan
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Night Vision

Postby falafel » Sat Mar 12, 2011 11:31 pm

Image

I got this by changing values of /rendering/scene/ambient/green to 0.5 while flying at night.
As said before, this can only be achieved while paused. If someone knows what to change in order to make it persist, it could be the answer for all those willing to fly night missions.
I wonder if the solution would be something related to hack the new menu with anaglyph support, making a new option that would be 2d but using green light.
falafel
 
Posts: 73
Joined: Mon Nov 09, 2009 11:42 am
Callsign: falafel
Version: 2
OS: Linux

Re: Night Vision

Postby SharjeelHKh » Mon Sep 12, 2011 5:28 am

I found this post very productive and able to see the results straight away by editing ALL frag shaders in FlightGear directly the code TYother mentioned above.

TYother-> Have u able to make this effect optional at runtime using any property etc..?
SharjeelHKh
 
Posts: 35
Joined: Mon Oct 11, 2010 5:24 am

Re: Night Vision

Postby sgofferj » Sun Jan 08, 2012 6:38 pm

I was thinking if there maybe is another approach than core-hacking.
Some aircraft have windows which are a bit tinted or have different effects.

Would it be possible to define some kind of material shader that simply alters the light that passes through this material, so you have the NVG effect? Aircraft/cockpit developers could then use this material e.g. for the frontplate of an MFD or for the HUD. Or for defining a view that realistically mimics NV goggles.

Considering how realistic and real-world-physics-based FG is, I thought, mimicking the function of a real-world NV system (i.e. altering the light that passes through it) would be the logical approach...
FG 3.1 GIT / Opensuse 12.3 / Phenom II X4 / GForce GTX560
Stefan's little Flightgear corner | The Finnish Weather Center | Wolves in Finland

Working on: EFTP
COM: IAX2:home.gofferje.net/stefan (MO-FR 0700-2000 UTC, SA+SU 0900-2000 UTC)
sgofferj
 
Posts: 789
Joined: Mon Dec 05, 2011 5:13 pm
Location: EFTP
Callsign: OH-SW
Version: 3.1 GIT
OS: Opensuse

Re: Night Vision

Postby Johan G » Tue Jan 10, 2012 7:23 am

There was some experimenting with that some time ago using shader effects I think, but it seem to have been a dead end. Se this topic: Night vision.
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: 6634
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: Night Vision

Postby sgofferj » Tue Jan 10, 2012 7:12 pm

That is exactly this topic here :lol:
FG 3.1 GIT / Opensuse 12.3 / Phenom II X4 / GForce GTX560
Stefan's little Flightgear corner | The Finnish Weather Center | Wolves in Finland

Working on: EFTP
COM: IAX2:home.gofferje.net/stefan (MO-FR 0700-2000 UTC, SA+SU 0900-2000 UTC)
sgofferj
 
Posts: 789
Joined: Mon Dec 05, 2011 5:13 pm
Location: EFTP
Callsign: OH-SW
Version: 3.1 GIT
OS: Opensuse

Re: Night Vision

Postby Johan G » Tue Jan 10, 2012 10:21 pm

Oops. Should at least have read the title of the topic before posting... :oops: :lol:

EDIT: Not to mention reading a few posts back... :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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
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: Night Vision

Postby sgofferj » Tue Jan 10, 2012 11:02 pm

I was playing around. It's pretty easy to get the picture partially green. The VMX22's windows have a png mapped to it as shader. Making this 50% green-transparent already gives a pretty green picture.
Image

Unfortunately, I don't know anything about shaders... If somebody could point me to a good reference...?
FG 3.1 GIT / Opensuse 12.3 / Phenom II X4 / GForce GTX560
Stefan's little Flightgear corner | The Finnish Weather Center | Wolves in Finland

Working on: EFTP
COM: IAX2:home.gofferje.net/stefan (MO-FR 0700-2000 UTC, SA+SU 0900-2000 UTC)
sgofferj
 
Posts: 789
Joined: Mon Dec 05, 2011 5:13 pm
Location: EFTP
Callsign: OH-SW
Version: 3.1 GIT
OS: Opensuse

Next

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 2 guests