Board index FlightGear Development Effects and shaders

Comments on cockpit lighting techniques

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

Comments on cockpit lighting techniques

Postby Thorsten » Tue Aug 16, 2016 5:02 pm

I'd like to take the opportunity to illustrate a point I've been trying to make on various occasions in words: If you have a (near)-static scene, offline rendering techniques are far more powerful than real-time.

Here's two scenes from the Shuttle cockpit with lightmaps applied - Wayne did these lightmaps - with a different lamp on in each:

Image

Image

They're essentially done with a raytracer run over the mesh - which is why the switch guards cast shadows, and there's indirect illumination over the whole cockpit for every light on as lit surfaces continue to reflect light more and more diffusely, some occlusion in the cavities,...

It takes quite some time for the raytracer to do it, but once it's done, it's in the lightmap, and in-sim you just can look it up. There's no other real-time technique to illuminate a cockpit - not deferred rendering, not a geometrical illumination criterion - that can come even close in quality.

I find this a very striking illustration of the idea that a 'real' light is not necessarily achieved by putting it into the real time technique and that solving lighting situations offline whenever this is feasible almost unconditionally delivers better results - just because there's essentially infinite processing power available.
Thorsten
 
Posts: 9147
Joined: Mon Nov 02, 2009 8:33 am

Re: Comments on cockpit lighting techniques

Postby jarl.arntzen » Thu Aug 18, 2016 12:22 pm

Nice! What's the basic procedure Blender --> FGFS?
Frequent Flyer. Occasional Lander.
jarl.arntzen
 
Posts: 103
Joined: Thu Jan 03, 2013 9:43 pm
IRC name: Jarl Arntzen
Version: 2017.1.1
OS: Ubuntu 14.04

Re: Comments on cockpit lighting techniques

Postby wlbragg » Fri Aug 19, 2016 5:53 am

What's the basic procedure Blender --> FGFS?

It's actually pretty simple if your blend is set up correctly, ie: all objects are mapped to their own texture space without overlaps.

Make a copy of the blend and use the copy to generate the maps. You could do this with the original and undo it when finished or not save it, but if it a very complicated or detailed blend with many parts, it nice to do the next step and save it for building other lightmaps or editing them.

Join all the objects in the blend that you want to lightmap.

You can find instructions for creating (bake) the actual lightmap by doing a YouTube or Google search. It's actually a fairly simple Blender technique. Bottom line is it takes the objects that are being mapped to be in edit mode, thus the joining of all the objects to be able to have them all in edit at the same time.

After the Blender bake you save the maps as png's.

Bring the baked lightmaps into Gimp or equivalent and for multi-channel lightmaps separate each light source baked into a single rgba color channel, including using the alpha channel for one.

Add some Gaussian blur to the map to soften the edges.

Recombine the 4 channels (r,g,b,a) back into a single image. This image can be used to simulate four different light sources in your model.

Export the final "recombined" image as a png for use with FG and the lightmap or mult-channel lightmap effect.

I'll try to take the time over the next few days to do a detailed wiki tutorial for those interested in the procedure.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3871
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Comments on cockpit lighting techniques

Postby jarl.arntzen » Fri Aug 19, 2016 12:20 pm

Thanks, wlbragg / Thorsten! I will try this when I see an opportunity.
Frequent Flyer. Occasional Lander.
jarl.arntzen
 
Posts: 103
Joined: Thu Jan 03, 2013 9:43 pm
IRC name: Jarl Arntzen
Version: 2017.1.1
OS: Ubuntu 14.04

Re: Comments on cockpit lighting techniques

Postby chris_blues » Fri Aug 19, 2016 5:34 pm

wlbragg wrote in Fri Aug 19, 2016 5:53 am:I'll try to take the time over the next few days to do a detailed wiki tutorial for those interested in the procedure.

Please do! This looks amazing! I've been looking over the wiki-page for lightmaps, and found it somewhat vague. Then I've experimented in Blender without useful results. These lamps behave erratic. No light, when put directly in front of the panel, but the entire cockpit is illuminated. By the looks of it, just by the ambient illumination. Shadows look mighty strange... I wasn't able to achieve anything... :evil:
What to do with the various intruments, which are completely different models? I usually only have the flightdeck.ac. Then included via XML there are the various gauges and stuff. Do I have to import these into Blender as well? And painfully find their correct position?

Thanks in advance and cudos for this nice improvement!

Edit: What is a blend? A scene in blender? The whole Blender project?
Don't hesitate to let me know if I'm incorrect or just annoying! As long as you do it gently! :)
Debian testing 64bit - Athlon II 2x2.6GHz - 8GB RAM - GeForce GTS 450
Citation II
User avatar
chris_blues
 
Posts: 1524
Joined: Mon May 03, 2010 1:30 pm
Location: claws of real life
Callsign: chris_blues
Version: GIT
OS: Debian 8 64

Re: Comments on cockpit lighting techniques

Postby wlbragg » Fri Aug 19, 2016 5:48 pm

chris_blues wrote in Fri Aug 19, 2016 5:34 pm:
wlbragg wrote in Fri Aug 19, 2016 5:53 am:I'll try to take the time over the next few days to do a detailed wiki tutorial for those interested in the procedure.

Please do!

I'm doing it right now. Barring any interruptions, I should have something in the wiki in an hour or two.

What is a blend?

That is just what I cal the entire blender scene.

What to do with the various intruments, which are completely different models?

That is a bit of a hurdle, If they are 1-1 in coordinate space then add them to your blend and join them with the rest of the oblects. That is part of the tutorial coming up. You have to make a single object to use for baking the map in Blender. That final "single" object has to contain all objects affecting, and being affected by, the lightmap.

And painfully find their correct position?

Yes, if you want then in the lightmap, that is the hurdle!
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3871
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Comments on cockpit lighting techniques

Postby chris_blues » Fri Aug 19, 2016 5:50 pm

Ok, thanks! So I won't interrupt no more and eagerly await the wiki page you're doing! :)
Don't hesitate to let me know if I'm incorrect or just annoying! As long as you do it gently! :)
Debian testing 64bit - Athlon II 2x2.6GHz - 8GB RAM - GeForce GTS 450
Citation II
User avatar
chris_blues
 
Posts: 1524
Joined: Mon May 03, 2010 1:30 pm
Location: claws of real life
Callsign: chris_blues
Version: GIT
OS: Debian 8 64

Re: Comments on cockpit lighting techniques

Postby wlbragg » Fri Aug 19, 2016 8:13 pm

@ chris_blues

Barring any interruptions

To be clear, that wasn't meant for you, it was referring to the many people currently in close proximity to me. :lol:

I have all the screen shots uploaded in the wiki and the Blender part of the tutorial is basically written, if you want to check it out. There may be enough information to get you going. It's really rough in the formatting, wiki formatting is akin to pulling teeth to me.

The Gimp part however is also very detailed and I only have the images in at the moment.
http://wiki.flightgear.org/Howto:Multi-channel_lightmap

Unfortunately I am being called away so I'll have to get back to it later.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3871
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Comments on cockpit lighting techniques

Postby wlbragg » Fri Aug 19, 2016 8:32 pm

Attention to all looking at this thread and the documentation in progress.

per another development thread.

You have to make a single object to use for baking the map in Blender.


No, you don't need! The important thing is to uncheck "Clear" in the Baking Menu. So you can select an object, bake the map, select another object, bake the map, and so on...

Important: you can only use 4 lights per object. Each light needs its own RGB-channel: Light 1= red, Light 2= green; Light 3 = blue, Light 4= alpha. So you when you bake make one light red, the other one blue, and the other one green. So you can at least have three lights enabled at the same time while baking, and so you save time and you don't need to recombine them in Gimp. Except the one for the fourth light using the alpha channel.

Another tip: using Blender Cycles with GPU acclerates the rendering time a lot. Plus you can define the lights: spotlights and how it behaves (soft and hard edge, width), pointlights, planar-lights or even meshlights. Since it renders in runtime you have a preview and you can see how it will looks later.
And: if you create realistic materials, you can get a nearly photorealistic output, since the light will bounce and illuminate as in real!

So at the Cessna 182 S I used a meshlight for the glareshieldlight, a spotlight for the pedestal lighting, a spotlight for each domelight and one for the baggage area.


Some of this I haven't covered yet in the wiki and some of it I have wrong due to lack of experience. When finished the wiki should have it all correct.

I am a complete amateur at this stuff, (first time I ever used it). I not only dislike documenting things, I dislike even more using the wiki format and when I am unsure about all the options (as in baking in stages using different textures).
I knew in the back of my mind that it couldn't be the only way to bake the map (ie only one texture and one object) but without experience I muttled through it and did what I did.

I am only doing the documentation out of a sense of obligation to the community. There are way more experienced people than I that could be adding to it and helping in its creation.

Also note this is the very first pass at getting the info in the wiki and will undoubtedly go through many revisions.

Please feel free to comment on this thread any inaccuracies you might see in the wiki as it progresses.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3871
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Comments on cockpit lighting techniques

Postby bugman » Fri Aug 19, 2016 8:43 pm

For an initial page, it's looking great: Howto:Multi-channel lightmap. If you have any wiki specific questions, just ask on the talk/discussion page. You might get a more focused response. One thing that you might find useful is the gallery wiki template.

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

Re: Comments on cockpit lighting techniques

Postby Thorsten » Sat Aug 20, 2016 4:33 am

I am only doing the documentation out of a sense of obligation to the community. There are way more experienced people than I that could be adding to it and helping in its creation.


Welcome to the club... (does anyone like writing documentation?)

The idea of a wiki actually is that people who know more can simply edit the text or add useful information. The reality is that they still prefer to comment from the sidelines though... but if that happens, just tell them that it's a wiki :-)
Thorsten
 
Posts: 9147
Joined: Mon Nov 02, 2009 8:33 am

Re: Comments on cockpit lighting techniques

Postby wlbragg » Sat Aug 20, 2016 5:23 am

does anyone like writing documentation?

Maybe the inventors of the wiki? :lol:

Important: you can only use 4 lights per object.

I need some clarification on this.
I think this is referring to only being able to use 4 light sources "if" you want to have Blender auto-magically separate the 4 light sources out into the 4 separate rgba channels so you don't have to do it in Gimp later.
When in reality you can have as many light sources on in a scene as you want and still burn a single light map that represents many lights on at the same time.
Or in another scenario you could have 5 lights on and combined in one channel (r), 6 in another (g), 1 in another (b) and 3 in the alpha. For a total of 15 light sources represented in one four channel light map. But if you want Blender to separate them out per channel you can only assign one per channel?
That is a bit confusing, is there no way to assign 2 lights to one channel (r), 1 to another (g) and 3 to the last (b) and still have blender break that out into the 3 or 4 channels?

You have to make a single object to use for baking the map in Blender.

No, you don't need! The important thing is to uncheck "Clear" in the Baking Menu. So you can select an object, bake the map, select another object, bake the map, and so on...

OK, I get this too, but aren't you still are required to have only one texture per light map? How can you apply or or bake a multi-textured lightmap in a single effect?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3871
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Comments on cockpit lighting techniques

Postby bugman » Sun Aug 21, 2016 8:50 am

Thorsten, you should add a few of your final screenshots and forum/mailing list text as an intro to the wiki article (no quoting ;)). That would be a great start to highlight the point of doing these lightmaps.

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

Re: Comments on cockpit lighting techniques

Postby Hooray » Sun Aug 21, 2016 9:44 am

I agree, the wiki article is looking really good - and the point of the wiki really is that people can join forces without requiring any special privileges (think commit access), and to ensure that there is only a single version of an article that can be maintained by the community as a whole - given the state of the wiki article, it is pretty safe to say that this article will be there to stay, even 10+ years from now - when many/most of us may have moved on, but it will definitely continue to be maintainable, and maintained, unlike much of the fgdata/Docs documentation, and unlike most external web pages, which may no longer be available by then (see for instance the original Nasal mailing list, the Nasal website - or even the original avsim.com flightgear forum).

The wiki really is a pretty good option to contribute in a future safe way - and even if people don't like it, they can still contribute documentation in other formats (Microsoft Word, LaTex, PDF, plain text files, HTML etc) - in fact, Stuart and others have offered on various occasions to help review and integrate such contributions so that they can be included in the official manual.
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: 11002
Joined: Tue Mar 25, 2008 8:40 am

Re: Comments on cockpit lighting techniques

Postby jaxsin » Sat Oct 01, 2016 5:37 pm

Well, I want to try this technique out myself. But I am really confused on a few aspects. In the wiki it says that textures should be combined to one texture sheet. I suppose this means if I have multiple texture sheets and want to lightmap those objects that use separate texture sheets, this is not going to work?
Is it then the ideal solution to make one large texture sheet, combine all the sheets together and retexture the interior?
I came into this project and the multiple texture sheets were already in place. But if I need to spend the hours remapping then so be it.
jaxsin
 
Posts: 396
Joined: Mon Dec 28, 2015 3:54 pm

Next

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 2 guests