Board index FlightGear Development Aircraft

Lightmaps

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Lightmaps

Postby legoboyvdlp » Thu Aug 03, 2017 4:49 pm

Hi there,
I'm trying to create the A320 winglights. However, I have no idea how to do it in Blender. How can I use the 'bake' tool to create a lightmap?

There is only one object for the whole wing.

Please, if you can tell me how to create a lightmap, I'd be very grateful (and is there a way to get a lightmap WITHOUT ALS enabled?)

Many thanks.
Jonathan
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby Thorsten » Thu Aug 03, 2017 4:55 pm

Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Lightmaps

Postby legoboyvdlp » Thu Aug 03, 2017 6:29 pm

Thank you.
Would this: "This will cause a problem when baking the lightmap by causing the bake to apply two different light conditions to the same texture space." cause an error called "circular reference in texture stack"?
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby tikibar » Thu Aug 03, 2017 6:41 pm

Yes. That is the error message to expect. That and wildly incorrect looking light map. It just takes a very small UV map overlap to blow the whole thing.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: Lightmaps

Postby hamzaalloush » Thu Aug 03, 2017 7:31 pm

I looked into this model, the "circular reference in texture stack" was due to the "face textures" and "face textures alpha" in the material options, so these were the steps to create a lightmap:

- import ac
- select object
- go into materials in properties panel, and disable face textures and face textures alpha in material options
- disable the active texture slot(unless you want to bake the light into the base texture itself)
- select a new texture slot for this object, and press New with "Image or Movie" type
- get into Edit mode and select all
- go to the UV / Image Editor and create a new image with your preference(size, transparency, color etc)
- go into render in properties panel and press Bake
hamzaalloush
 
Posts: 632
Joined: Sat Oct 26, 2013 9:31 am
OS: Windows 10

Re: Lightmaps

Postby legoboyvdlp » Fri Aug 04, 2017 10:32 am

That's great, hazma: I'll give it a go. D-ECHO also said to disable the texture, so this should hopefully help.

And tikibar, thank you, looks like I have to make a new UVMAP for the wings then, maybe?
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby legoboyvdlp » Fri Aug 04, 2017 11:55 am

Successfully done: http://imgur.com/a/Tiuad


Just have to apply it now, should be able to figure it out eventually.
Last edited by legoboyvdlp on Fri Aug 04, 2017 2:06 pm, edited 1 time in total.
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby legoboyvdlp » Fri Aug 04, 2017 12:03 pm

So @Thorsten,
I've created the lightmap successfully and extracted the red channel per the README file which says that n=0 is the red channel.
The lightmap .eff file is as follows:

Code: Select all
<PropertyList>
    <name>winglightmap</name>
    <inherits-from>Effects/model-combined-deferred</inherits-from>
    <parameters>
        <normalmap-enabled type="int">0</normalmap-enabled>
        <reflection-enabled type="int">1</reflection-enabled>
        <reflection-dynamic type="int">1</reflection-dynamic>
        <reflect_map-enabled type="int">0</reflect_map-enabled>
        <reflection-correction type="float">0.1</reflection-correction>
        <lightmap-enabled type="int">1</lightmap-enabled>
        <lightmap-multi type="int">0</lightmap-multi>
        <lightmap-factor type="float" n="0"><use>controls/lighting/wing-lights</use></lightmap-factor>
        <lightmap-color type="vec3d" n="0">1.0 1.0 1.0</lightmap-color>
        <texture n="3">
            <image>Aircraft/A320Family/Models/Effects/LightMappedWing-red.png</image>
            <filter>linear-mipmap-linear</filter>
            <wrap-s>clamp</wrap-s>
            <wrap-t>clamp</wrap-t>
            <internal-format>normalized</internal-format>
        </texture>
        <texture n="5">
            <type>cubemap</type>
            <images>
                <positive-x>Aircraft/Generic/Effects/fgfs-sky2/1.png</positive-x>
                <negative-x>Aircraft/Generic/Effects/fgfs-sky2/4.png</negative-x>
                <positive-y>Aircraft/Generic/Effects/fgfs-sky2/2.png</positive-y>
                <negative-y>Aircraft/Generic/Effects/fgfs-sky2/3.png</negative-y>
                <positive-z>Aircraft/Generic/Effects/fgfs-sky2/6.png</positive-z>
                <negative-z>Aircraft/Generic/Effects/fgfs-sky2/5.png</negative-z>
            </images>
        </texture>
    </parameters>
</PropertyList>


(adapted from 777)

However, with full MODEL shader and ALS on, nothing appears: the objects which I applied the texture to:
Code: Select all
<effect>
        <inherits-from>Aircraft/A320Family/Models/Effects/winglightmap</inherits-from>
        <object-name>SlatL1</object-name>
        <object-name>SlatL2</object-name>
        <object-name>SlatL3</object-name>
        <object-name>SlatL4</object-name>
      <object-name>SlatL5</object-name>
      <object-name>SlatR1</object-name>
        <object-name>SlatR2</object-name>
        <object-name>SlatR3</object-name>
        <object-name>SlatR4</object-name>
      <object-name>SlatR5</object-name>
      <object-name>Wings</object-name>
   </effect>


are only lit by the moonlight.
Link to lightmap: http://i.imgur.com/aMKFbaD.png

And also, I have a question: see viewtopic.php?f=4&t=30928&p=315685#p315685
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby legoboyvdlp » Fri Aug 04, 2017 1:08 pm

I just found a bug -- I didn't set up the lightmap color. That may help.

Also, I may need to do this:
Code: Select all
<texture n ="0">

          - the model texture, as assigned in the 3d-modelling
          application, or by the livery select mechanism.
          This only needs to be present in the main effect.
          Setting this to some specific texture will override
          the assigned texture/livery.


But there is nothing to tell me how to actually define the model texture to eg. Models/Wings/res/wings.png.

How can I do that?
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby legoboyvdlp » Fri Aug 04, 2017 2:03 pm

Thorsten, everything works. Just applying the lightmap to the slats.
However, I still need to know about <texture n="0"> and https://forum.flightgear.org/viewtopic.php?f=4&t=30928&p=315685#p315685.
Many thanks.
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Lightmaps

Postby Thorsten » Fri Aug 04, 2017 4:33 pm

http://wiki.flightgear.org/Howto:Add_ef ... n_aircraft

texture n=0 is whatever you assign in blender (ac3d, sketchup...) as the base texture of a surface. There's no explanation how this is done because it depends on what your 3d modeling application is. In effect files, we normally don't touch it unless there's a very good reason to.

The external lights are an undocumented feature added for testing and evaluation. Richard is working on making this easy to use by referencing a 3d object and this is when it will be officially added - if you want to use it now, you need to reverse-engineer the c-172p code (I think Wayne has converted my original proof of concept Nasal script into property rules, but you may want to ask him for details).
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Lightmaps

Postby legoboyvdlp » Fri Aug 04, 2017 4:38 pm

Great :)
That's fine, I'll wait.
I managed it -- the most difficult part was making the lightmap look nice (ie. scaling, rotating the light) rather than making it work, as I thought! :P
User avatar
legoboyvdlp
 
Posts: 7126
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP


Return to Aircraft

Who is online

Users browsing this forum: No registered users and 3 guests