Board index FlightGear Development Aircraft Cockpit development

Brightness depending on view?

Discussion about creating 2d and 3d cockpits.

Brightness depending on view?

Postby fmg » Sat Jun 01, 2019 2:32 pm

Hello,

I'm working on a plane and like to change the brightness of a part depending on the actual view.
In the .ac-file the material is set to diffuse 1.0 and ambient 0.5.
If a special view is selected it should appear darker. Tried it with several code, but it never worked.
The brightness always stayed on the dark value, even when the condition ins't true.
This is my last code:

Code: Select all
  <animation>
  <type>material</type>
  <object-name>Innenraum</object-name>
        <condition> 
         <or>
          <greater-than>
           <property>sim[0]/current-view/view-number</property>
           <value>13</value>
          </greater-than>
          <less-than>
           <property>sim[0]/current-view/view-number</property>
           <value>11</value>
          </less-than>
          </or>
        </condition>

          <diffuse>
            <red>   0.28 </red>
            <green> 0.28 </green>
            <blue>  0.28 </blue>
          </diffuse>
 
          <ambient>
            <red>   0.15 </red>
            <green> 0.15 </green>
            <blue>  0.15 </blue>
          </ambient>

          <specular>
            <red>   0.03 </red>
            <green> 0.03 </green>
            <blue>  0.03 </blue>
          </specular>
   </animation>


What am I doing wrong?
User avatar
fmg
 
Posts: 541
Joined: Tue Jun 29, 2010 5:13 pm
Location: EDDI
Callsign: fotomas
Version: 2
OS: Mac OS X 10.6.8

Re: Brightness depending on view?

Postby legoboyvdlp » Sat Jun 01, 2019 2:54 pm

You need to define what happens when the condition is false: for example:

Code: Select all
<animation>
  <type>material</type>
  <object-name>Innenraum</object-name>
        <condition> 
<not>
         <and>
          <greater-than>
           <property>sim[0]/current-view/view-number</property>
           <value>13</value>
          </greater-than>
          <less-than>
           <property>sim[0]/current-view/view-number</property>
           <value>11</value>
          </less-than>
          </and>
</not>
        </condition>

   </animation>


notice the addition of not and changing of or to and.

If you do something like that it should work.
User avatar
legoboyvdlp
 
Posts: 7090
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Brightness depending on view?

Postby fmg » Sat Jun 01, 2019 3:05 pm

Thanks,
tried your code, but it stays the same. I tried also a clear condition before (view=11). But that also didn't work.
So I'm affraid that the problem isn't the condition. Is there a way to test if a condition is true?
User avatar
fmg
 
Posts: 541
Joined: Tue Jun 29, 2010 5:13 pm
Location: EDDI
Callsign: fotomas
Version: 2
OS: Mac OS X 10.6.8

Re: Brightness depending on view?

Postby legoboyvdlp » Sat Jun 01, 2019 3:18 pm

To be sure, you did also add a material definition to my code?

That is,

You had two seperate animations.
One is the code in your first post, and one is the code in my post, with the material settings added in?

Just to check the simple thing first ;)
User avatar
legoboyvdlp
 
Posts: 7090
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Brightness depending on view?

Postby fmg » Sat Jun 01, 2019 3:34 pm

I used the material defintition I allready had.
If I would haved missed the definition it should stay bright, but it stayed dark.
User avatar
fmg
 
Posts: 541
Joined: Tue Jun 29, 2010 5:13 pm
Location: EDDI
Callsign: fotomas
Version: 2
OS: Mac OS X 10.6.8

Re: Brightness depending on view?

Postby wlbragg » Sat Jun 01, 2019 4:10 pm

Looking at examples in the c172p, i don't think you need the opposing condition. It should only change from default to "modified" if condition is true.
We use skydome = false as a condition to apply a material and also use a property value for the degree of change.
Code: Select all
    <animation>
        <type>material</type>
        <object-name>TrimWheel</object-name>
...
        <object-name>RudderTrimKnob</object-name>
        <condition>
            <not>
                <property>/sim/rendering/shaders/skydome</property>
            </not>
        </condition>
        <emission>
            <red-prop>/sim/model/c172p/lighting/rgb-ra-r-factor</red-prop>
            <green-prop>/sim/model/c172p/lighting/rgb-ra-g-factor</green-prop>
            <blue-prop>/sim/model/c172p/lighting/rgb-ra-b-factor</blue-prop>
        </emission>
    </animation>


Dummy it down and try a preset property you can change as the condition to see if you can get it to work at all.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4909
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Brightness depending on view?

Postby fmg » Sat Jun 01, 2019 7:13 pm

Thanks for all the sugestions.
Tied it now to several properties, but it dosen't work at all. Looks like the condition-tag is simply ignored.
User avatar
fmg
 
Posts: 541
Joined: Tue Jun 29, 2010 5:13 pm
Location: EDDI
Callsign: fotomas
Version: 2
OS: Mac OS X 10.6.8

Re: Brightness depending on view?

Postby wlbragg » Sat Jun 01, 2019 8:16 pm

Then instead of a condition use a property factor that changes depending on view.

Code: Select all
<ambient>
  <red><red-prop>/sim/model/c172p/lighting/rgb-ra-r-factor</red-prop></red>
  <green><green-prop>/sim/model/c172p/lighting/rgb-ra-g-factor</green-prop></green>
  <blue><blue-prop>/sim/model/c172p/lighting/rgb-ra-b-factor</blue-prop></blue>
</ambient>


/sim/model/c172p/lighting/rgb-ra-r-factor is either 1.0 or 0.28 depending on condition.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4909
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640


Return to Cockpit development

Who is online

Users browsing this forum: No registered users and 1 guest