Board index FlightGear Development Effects and shaders

OSG Text colour

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

OSG Text colour

Postby Maerchenprinz » Tue Sep 26, 2017 4:09 pm

Hi all!

Is there any way to change the colour of a (white) OSG text object? - It took me a few minutes to have the text on screen
and a few more hours to find no solution how to change its colour...

Here's the snippet:
Code: Select all
  <text>
    <name>textosg</name>
    <offsets>
      <x-m>-0.09</x-m>
      <y-m>0.05</y-m>
      <z-m>0.06</z-m>
      <heading-deg>90</heading-deg>
    </offsets>
    <alignment>center-center</alignment>
    <axis-alignment>xy-plane</axis-alignment>
    <type type="string">number-value</type>
    <property>an24/ARK-11/fix1-1</property>
    <format type="string">%.1f</format>
    <truncate type="bool">false</truncate>
    <font>arial_black.txf</font>
    <character-size type="double">0.006</character-size>
    <character-aspect-ratio type="double">1.0</character-aspect-ratio>
    <font-resolution>
      <width type="int">32</width>
      <height type="int">32</height>
    </font-resolution>
  </text>

    <animation>
      <type>material</type>
      <object-name>textosg</object-name>
       <diffuse>
        <red>1</red>
        <green>0</green>
        <blue>0</blue>
       </diffuse>
       <ambient>
        <red>1</red>
        <green>0</green>
        <blue>0</blue>
       </ambient>
       <specular>
        <red>1</red>
         <green>0</green>
         <blue>0</blue>
        </specular>
        <emission>
         <red>1</red>
         <green>0</green>
         <blue>0</blue>
        </emission>
      </animation>

Other animations such as "rotate" do work, "material" does not.
I've tried so much that I suspect that there's no possibility at all. I know, Canvas could do, but there's really no
need to put up a big canvas-solution for such a small problem...
Background: I have an ADF-controller (ARK-11) with a memory device (9 frequencies); A white board to write the stored frequencies
next to the nine "program-and-recall"-buttons. That's all! But white numbers on a white board are, well,.., uhm, no!

Any (attempt to) help is welcome as it will keep my head from banging-on-desk :)

Ciao,
Adrian
User avatar
Maerchenprinz
 
Posts: 168
Joined: Thu Mar 15, 2007 5:24 pm
Location: Bochum, it's better, much better than you think!
Callsign: Adrian

Re: OSG Text colour

Postby AndersG » Tue Sep 26, 2017 8:18 pm

Material animation should work, at least if you apply it one step above the text.
See, e.g., https://github.com/andgi/FlightGear-ZLT-NT/blob/master/Models/Instruments/CenterMFD/display-text.xml.
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2441
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: OSG Text colour

Postby Thorsten » Wed Sep 27, 2017 5:20 am

Please note that the OSG Text objects don't seem to play nice with the renderer (I seem to remember they could be seen unaffected by the g-force effect for instance) - a texture of canvas solution is therefore preferable.
Thorsten
 
Posts: 10969
Joined: Mon Nov 02, 2009 8:33 am

Re: OSG Text colour

Postby Maerchenprinz » Wed Sep 27, 2017 10:49 am

Hi Anders & Thorsten,

thanks for your replies!
@ Anders: Unfortunately, your solution didn't do the trick. I've also noticed that the params in your display-text.xml have
no effect either. The numbers on the MFD of your ZLT-NT are white irrespective of their color values...
@ Thorsten: Maybe I have to get used to the idea of a canvas solution - If I won't find a slim way to do so, I'll leave the user with paper
and pencil to note the frequencies (IRL!!) :D

Ciao,

Adrian
User avatar
Maerchenprinz
 
Posts: 168
Joined: Thu Mar 15, 2007 5:24 pm
Location: Bochum, it's better, much better than you think!
Callsign: Adrian

Re: OSG Text colour

Postby AndersG » Wed Sep 27, 2017 6:19 pm

Maerchenprinz wrote in Wed Sep 27, 2017 10:49 am:Hi Anders & Thorsten,

thanks for your replies!
@ Anders: Unfortunately, your solution didn't do the trick. I've also noticed that the params in your display-text.xml have
no effect either. The numbers on the MFD of your ZLT-NT are white irrespective of their color values...


Hmm.. are you using the Rembrandt graphics pipeline? IIRC it only supports uncoloured emissive (opaque?) objects so that'd explain it.
The text at least used to be coloured with the other graphics pipelines.

OTOH, using Canvas would seem to be the better option today...

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2441
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: OSG Text colour

Postby Maerchenprinz » Fri Sep 29, 2017 7:38 pm

Hi!

No, no rembrandt pipeline definition by me that I was aware of...
Well, Anders, I got your subtle "...the better option TODAY"-hint :wink: , and will
take a look at some FG-planes with canvas for inspiration - Others learn from mistakes,
I learn from copy and pastes!

Ciao,
Adrian
User avatar
Maerchenprinz
 
Posts: 168
Joined: Thu Mar 15, 2007 5:24 pm
Location: Bochum, it's better, much better than you think!
Callsign: Adrian


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 9 guests