Board index FlightGear Development Scenery

Edge Lighting Experiments

Questions and discussion about enhancing and populating the FlightGear world.

Re: Edge Lighting Experiments

Postby VicMar » Tue May 07, 2019 7:03 am

I don't want to sound like a miserable old Scenery Model Validator but :-

The objects have been presented in a form which shows great detail. As their use would be many of the same objects in close proximity (at airports), unless the .ac file for each object will be very small, there will be a massive impact on fps.

I think this should be considered before going ahead.

Vic
Time flies like an arrow
Fruit flies like a banana
User avatar
VicMar
 
Posts: 2056
Joined: Sun Apr 06, 2008 5:53 pm
Location: Lancing. UK (EGKA)
Callsign: VicMar
Version: 2018.3.1
OS: OS X 10.12.6

Re: Edge Lighting Experiments

Postby abassign » Tue May 07, 2019 8:04 am

VicMar wrote in Tue May 07, 2019 7:03 am:I don't want to sound like a miserable old Scenery Model Validator but :-
The objects have been presented in a form which shows great detail. As their use would be many of the same objects in close proximity (at airports), unless the .ac file for each object will be very small, there will be a massive impact on fps.


Personally, after the tests we are doing on the G91R1B (currently the plane has more than 4 million vertices) I have strong doubts that there are problems on the frame rate just follow the rules: DO NOT USE ABSOLUTELY TEXTURE but work only with attributes color and, if necessary, with effects. It is obviously possible to use two / three types of objects as a function of the LOD, this allows to have an object well defined from near and little defined (few vertices) when they are distant. For the transparent part we use an effect that makes the surface very opaque when the lamp is off, but then it becomes less and less transparent as the brightness of the lamp increases. Be careful for the blue lights: The central light is violet because the incandescent lamp has a filament that is only partially filtered by the external blue.
I put an example of the blue lamp used for the G91R1B. I remind you that it is not easy to build a beautiful lamp for Flightgear, you have to do many tests with different lighting conditions!

Image

Image

Image

Image

Image

My code lap, for example is this:

Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>

<PropertyList>
   
    <path>Aircraft/G91-R1B_HD/Models/Parts/Common/lg_model_01.ac</path>

    <offsets>
        <x-m>0.0055</x-m>
        <y-m>0.0</y-m>
        <z-m>0.0</z-m>
        <pitch-deg>1.0</pitch-deg>
    </offsets>
   
    <effect>
        <inherits-from>Aircraft/G91-R1B_HD/Models/Effects/Interior_Shading/Interior_Shading</inherits-from>
        <object-name>box_button (Meshed)</object-name>
        <object-name>button_base (Meshed)</object-name>
        <object-name>ring (Meshed)</object-name>
        <object-name>screew (Meshed)</object-name>
        <object-name>silver_box_button (Meshed)</object-name>
    </effect>
   
    <effect>
        <inherits-from>Effects/model-transparent</inherits-from>
        <object-name>transparent_button (Meshed)</object-name>
        <object-name>light_Sphere (Meshed)</object-name>
        <object-name>light_Sphere_hot (Meshed)</object-name>
    </effect>
   
    <animation>
        <type>material</type>
        <object-name>button_base (Meshed)</object-name>
        <diffuse>
            <red>0.33</red>
            <green>0.31</green>
            <blue>0.30</blue>
        </diffuse>
        <ambient>
            <red>0.3</red>
            <green>0.3</green>
            <blue>0.3</blue>
        </ambient>
        <specular>
            <red>0.8</red>
            <green>0.8</green>
            <blue>0.8</blue>
        </specular>
        <emission>
            <red>0.051</red>
            <green>0.0</green>
            <blue>0.0</blue>
            <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>box_button (Meshed)</object-name>
        <diffuse>
            <red>0.33</red>
            <green>0.31</green>
            <blue>0.30</blue>
        </diffuse>
        <ambient>
            <red>0.1</red>
            <green>0.1</green>
            <blue>0.1</blue>
        </ambient>
        <specular>
            <red>0.3</red>
            <green>0.3</green>
            <blue>0.3</blue>
        </specular>
        <emission>
            <red>0.051</red>
            <green>0.0</green>
            <blue>0.0</blue>
            <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>ring (Meshed)</object-name>
        <diffuse>
            <red>0.4</red>
            <green>0.4</green>
            <blue>0.4</blue>
        </diffuse>
        <ambient>
            <red>0.2</red>
            <green>0.2</green>
            <blue>0.2</blue>
        </ambient>
        <specular>
            <red>0.3</red>
            <green>0.3</green>
            <blue>0.3</blue>
        </specular>
        <emission>
            <red>0.06</red>
            <green>0.0</green>
            <blue>0.0</blue>
            <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>screew (Meshed)</object-name>
        <diffuse>
            <red>0.5</red>
            <green>0.5</green>
            <blue>0.5</blue>
        </diffuse>
        <ambient>
            <red>0.3</red>
            <green>0.3</green>
            <blue>0.3</blue>
        </ambient>
        <specular>
            <red>0.5</red>
            <green>0.5</green>
            <blue>0.5</blue>
        </specular>
        <emission>
            <red>0.08</red>
            <green>0.0</green>
            <blue>0.0</blue>
            <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>silver_box_button (Meshed)</object-name>
        <diffuse>
            <red>0.8</red>
            <green>0.8</green>
            <blue>0.8</blue>
        </diffuse>
        <ambient>
            <red>0.7</red>
            <green>0.7</green>
            <blue>0.7</blue>
        </ambient>
        <specular>
            <red>0.7</red>
            <green>0.7</green>
            <blue>0.9</blue>
        </specular>
        <emission>
            <red>0.10</red>
            <green>0.0</green>
            <blue>0.0</blue>
            <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
        </emission>
    </animation>

</PropertyList>


This code has an extension per the colored lamp:

Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>

<PropertyList>
   
    <model>
        <path>Aircraft/G91-R1B_HD/Models/Parts/Common/lg_model_01.xml</path>
    </model>
   
    <animation>
        <type>material</type>
        <object-name>Cone_reflect (Meshed)</object-name>
        <diffuse>
            <red>0.0</red>
            <green>0.0</green>
            <blue>1.0</blue>
        </diffuse>
        <ambient>
            <red>0.0</red>
            <green>0.0</green>
            <blue>1.0</blue>
        </ambient>
        <emission>
            <red>0.0</red>
            <green>0.0</green>
            <blue>2.0</blue>
            <factor-prop>fdm/jsbsim/systems/warning-lights/cockpit/lg_collect_tank_2_all_tank</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>transparent_button (Meshed)</object-name>
        <transparency>
            <alpha>0.95</alpha>
            <factor-prop>fdm/jsbsim/systems/warning-lights/cockpit/lg_collect_tank_2_all_tank-transparent</factor-prop>
        </transparency>
        <diffuse>
            <red>0.0</red>
            <green>0.0</green>
            <blue>0.5</blue>
        </diffuse>
        <ambient>
            <red>0.0</red>
            <green>0.0</green>
            <blue>0.5</blue>
        </ambient>
        <specular>
            <red>0.5</red>
            <green>0.5</green>
            <blue>1.0</blue>
        </specular>
        <emission>
            <red>0.0</red>
            <green>0.0</green>
            <blue>1.5</blue>
            <factor-prop>fdm/jsbsim/systems/warning-lights/cockpit/lg_collect_tank_2_all_tank</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>light_Sphere (Meshed)</object-name>
        <transparency>
            <alpha>0.4</alpha>
        </transparency>
        <diffuse>
            <red>0.1</red>
            <green>0.1</green>
            <blue>0.1</blue>
        </diffuse>
        <ambient>
            <red>0.0</red>
            <green>0.0</green>
            <blue>0.0</blue>
        </ambient>
        <emission>
            <red>0.3</red>
            <green>0.5</green>
            <blue>1.5</blue>
            <factor-prop>fdm/jsbsim/systems/warning-lights/cockpit/lg_collect_tank_2_all_tank</factor-prop>
        </emission>
    </animation>
   
    <animation>
        <type>material</type>
        <object-name>light_Sphere_hot (Meshed)</object-name>
        <transparency>
            <alpha>0.4</alpha>
        </transparency>
        <diffuse>
            <red>0.1</red>
            <green>0.1</green>
            <blue>0.1</blue>
        </diffuse>
        <ambient>
            <red>0.0</red>
            <green>0.0</green>
            <blue>0.0</blue>
        </ambient>
        <emission>
            <red>1.5</red>
            <green>0.5</green>
            <blue>2.0</blue>
            <factor-prop>fdm/jsbsim/systems/warning-lights/cockpit/lg_collect_tank_2_all_tank</factor-prop>
        </emission>
    </animation>
   
    <model>
        <condition>
            <greater-than-equals>
                <property>fdm/jsbsim/systems/warning-lights/cockpit/lg_collect_tank_2_all_tank</property>
                <value>0.1</value>
            </greater-than-equals>
        </condition>
        <name>pb_light_effect</name>
        <path>Aircraft/G91-R1B_HD/Models/Parts/Cockpit/Effects/lights/procedural_light_cockpit_advise_blue.xml</path>
        <offsets>
            <x-m> 0.03</x-m>
            <y-m> 0.0 </y-m>
            <z-m> 0.0 </z-m>
        </offsets>
    </model>
   
</PropertyList>


If you want to test our G91R1B (GPL3 +) you can download it here:

https://github.com/abassign/G91-R1B_HD.git
abassign
 
Posts: 804
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Edge Lighting Experiments

Postby Thorsten » Tue May 07, 2019 9:41 am

I have strong doubts that there are problems on the frame rate just follow the rules: DO NOT USE ABSOLUTELY TEXTURE but work only with attributes color and, if necessary, with effects.


Good thing you're not deciding on how to add this then... Did it occur to you for instance that you may be optimizing for your graphics card?


It is obviously possible to use two / three types of objects as a function of the LOD, this allows to have an object well defined from near and little defined (few vertices) when they are distant.


Right, except the distance checks for thousands of objects you have to do then completely screw up every advantage you might have by using a low-poly object.


For the transparent part we use an effect that makes the surface very opaque when the lamp is off, but then it becomes less and less transparent as the brightness of the lamp increases.


Transparent = bad because there's thousands of additional objects which need to go into the transparent render bin where they're supposed to be z-ordered - sorting through lots of transparent objects again takes plenty of time.

Just because something works on your graphics card for your specific use case, it doesn't mean it is applicable or reasonable everywhere.

Instancing the model as has aready been said is clearly the way to go here.
Thorsten
 
Posts: 10965
Joined: Mon Nov 02, 2009 8:33 am

Re: Edge Lighting Experiments

Postby xDraconian » Tue May 07, 2019 6:02 pm

All very good points to take into consideration. Appreciate the feedback, collaboration, and advice.

I'm hoping to work on a prototype this weekend and I image there will be several refinements to balance functionality with usability before a final solution is reached.

@abassign, thanks for your detailed response and tips. Those screen shots look awesome. Nice work. I'll be doing a pull from your repo when I have a chance.

Scott
xDraconian
 
Posts: 240
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: Edge Lighting Experiments

Postby xDraconian » Tue May 07, 2019 6:11 pm

I've added a few more pics to the first post.
xDraconian
 
Posts: 240
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Previous

Return to Scenery

Who is online

Users browsing this forum: No registered users and 6 guests