Board index FlightGear Development Scenery

Nighttextures / Textranslate  Topic is solved

Questions and discussion about enhancing and populating the FlightGear world.

Nighttextures / Textranslate

Postby henrik_k » Mon Sep 24, 2018 8:50 am

Dear All, making my first strides at adding textured objects, I am working on the Alpha Rotex building, part of the new Gateway Gardens right next to Frankfurt airport.
I followed the instructions in the howto http://wiki.flightgear.org/Howto:Texture_a_building#Night_Textures.
Day textures work fine, switch to night textures as well, so the textranslate animation is properly triggered, but:

My problem: no matter what axis values I modify in the textranslate animation of the xml, the texture shifts along the x axis. I need it to shift along the y-axis, though, as my night texture is sitting on top of the texture file (like in the howto). It even shifts when all axis are set to "0"! However, I am certain that the textranslate animation is properly executed as it works fine as soon as I "comment out" (<!-- ... -->) the respective section of the xml.

It would be great if someone could point me in the right direction. Alternatively, I would be interested if the texture swap animation (having the night/day textures in separate files) would be an option for static objects (buildings) and if someone could give me example code, as I was unable to find it.

Thanks in advance!

The xml:
Code: Select all
<?xml version="1.0"?>

<PropertyList>

 <path>alpha_rotex1.ac</path>
 <animation>
   <type>range</type>
   <min-m>0</min-m>
   <max-m>25000</max-m>
 </animation>

 <animation>
   <type>textranslate</type>
   <object-name>alpha_rotex1</object-name>
   <property>/sim/time/sun-angle-rad</property>
   <step> 1.57 </step>
   <factor>0.318471338</factor>
   <center>
      <x-m> 0 </x-m>
      <y-m> 0 </y-m>
      <z-m> 0 </z-m>
   </center>
   <axis>
      <x>0</x>
      <y>-1</y>
      <z>0</z>
   </axis>
</animation>

<animation>
   <type>material</type>
   <object-name>alpha_rotex1</object-name>
   <condition>
      <greater-than>      
         <property>/sim/time/sun-angle-rad</property>
         <value>1.57</value>
      </greater-than>
   </condition>
   <emission>   
      <red>0.3</red>   
      <green>0.3</green>   
      <blue>0.3</blue>
   </emission>
</animation>

</PropertyList>


The ac file:
Code: Select all
AC3Db
MATERIAL "DefaultWhite" rgb 1.0000 1.0000 1.0000  amb 0.2000 0.2000 0.2000  emis 0.0000 0.0000 0.0000  spec 0.5000 0.5000 0.5000  shi 10 trans 0.0000
MATERIAL "alpha rotex 1" rgb 0.8000 0.8000 0.8000  amb 1.0000 1.0000 1.0000  emis 1.0000 1.0000 1.0000  spec 0.5000 0.5000 0.5000  shi 12 trans 0.0000
OBJECT world
kids 1
OBJECT poly
name "alpha_rotex1"
data 12
alpha_rotex1
loc -6.0618038 69.5146103 11.8372307
texture "alpha_rotex1.png"
texrep 1 1
crease 35.0
numvert 30
-71.9828033 -68.8040085 12.5531158
-72.3317337 -68.8040085 -9.5324593
-77.9727097 -68.8040085 7.5800114
-80.1423874 -68.8040085 1.6364822
-78.1615448 -68.8040085 -4.3726177
-72.3317337 85.7091751 -9.5324593
-71.9828033 85.7091751 12.5531158
-78.1615448 85.7091751 -4.3726177
-80.1423874 85.7091751 1.6364822
-77.9727097 85.7091751 7.5800114
46.6101723 -68.8040085 56.1269951
27.7355766 -68.8040085 67.6006165
45.3505173 -68.8040085 63.8097000
41.3212051 -68.8040085 68.6879807
35.1356583 -68.8040085 70.0191803
27.7355766 85.7091751 67.6006165
46.6101723 85.7091751 56.1269951
35.1356583 85.7091751 70.0191803
41.3212051 85.7091751 68.6879807
45.3505173 85.7091751 63.8097000
24.0158234 -68.8040085 -66.7628403
43.6967926 -68.8040085 -55.8983612
31.3703175 -68.8040085 -69.4145050
37.6931000 -68.8040085 -68.2809372
42.0215797 -68.8040085 -63.5346947
43.6967926 85.7091751 -55.8983612
24.0158234 85.7091751 -66.7628403
42.0215797 85.7091751 -63.5346947
37.6931000 85.7091751 -68.2809372
31.3703175 85.7091751 -69.4145050
numsurf 17
SURF 0X0
mat 1
refs 15
25 0.885157 0.375265
27 0.874924 0.384686
28 0.865033 0.389855
29 0.853188 0.385663
26 0.842955 0.375754
5 0.748550 0.288675
7 0.738235 0.278874
8 0.735518 0.271118
9 0.740970 0.267553
6 0.760269 0.267174
15 0.973214 0.267174
17 0.986165 0.267553
18 0.991618 0.272094
19 0.988412 0.279362
16 0.981027 0.286721
SURF 0X0
mat 1
refs 15
20 0.000000 0.000000
22 0.000000 0.000000
23 0.000000 0.000000
24 0.000000 0.000000
21 0.000000 0.000000
10 0.000000 0.000000
12 0.000000 0.000000
13 0.000000 0.000000
14 0.000000 0.000000
11 0.000000 0.000000
0 0.000000 0.000000
2 0.000000 0.000000
3 0.000000 0.000000
4 0.000000 0.000000
1 0.000000 0.000000
SURF 0X0
mat 1
refs 4
1 0.668725 -0.000561
5 0.668726 0.388999
26 0.057281 0.388999
20 0.057281 -0.000560
SURF 0X0
mat 1
refs 4
21 0.668725 -0.000561
25 0.668726 0.388999
16 0.057281 0.388999
10 0.057281 -0.000560
SURF 0X0
mat 1
refs 4
0 0.057281 -0.000560
6 0.057281 0.388999
9 0.026777 0.388999
2 0.026777 -0.000560
SURF 0X0
mat 1
refs 4
2 0.026777 -0.000560
9 0.026777 0.388999
8 0.001987 0.388999
3 0.001987 -0.000560
SURF 0X0
mat 1
refs 4
3 0.724272 -0.000561


The texture file:
Image

During day:
Image

During night:
Image
henrik_k
 
Posts: 9
Joined: Sun Jun 03, 2018 8:53 pm
Location: Wiesbaden, Germany
OS: Win10/Ubuntu 18.4

Re: Nighttextures / Textranslate

Postby Catalanoic » Mon Sep 24, 2018 2:09 pm

i have same the questions, specially night/day textures in separate files
User avatar
Catalanoic
 
Posts: 1099
Joined: Mon Mar 05, 2012 1:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2017.3
OS: Lubuntu/Windows 7

Re: Nighttextures / Textranslate  

Postby BecOzIcan » Mon Sep 24, 2018 2:22 pm

In

Code: Select all
   <axis>
      <x>0</x>
      <y>-1</y>
      <z>0</z>
   </axis>


Your Y value should be 1 and not -1 if the night texture if on the top of the PNG and the Day at the bottom like in the below example with one of my LFPG control towers

Cheers
Ian

Image
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

Re: Nighttextures / Textranslate

Postby BecOzIcan » Mon Sep 24, 2018 2:46 pm

Catalanoic wrote in Mon Sep 24, 2018 2:09 pm:i have same the questions, specially night/day textures in separate files


Lookup the Lightmap code in \data\AI\Aircraft\77L\main.xml
and
\data\AI\Aircraft\777\Effects\77L-LightMap.eff

Night Texture PNG sits in \Effects folder
Day Texture PNG sits in \Textures folder

See viewtopic.php?f=47&t=30000

Cheers
Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1302
Joined: Tue Oct 04, 2011 11:43 pm
Location: Sydney, NSW, Australia
Version: 2020.4.0
OS: Win10

Re: Nighttextures / Textranslate

Postby Catalanoic » Tue Sep 25, 2018 1:58 pm

thanks BecOzIcan, i'll try it
User avatar
Catalanoic
 
Posts: 1099
Joined: Mon Mar 05, 2012 1:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2017.3
OS: Lubuntu/Windows 7

Re: Nighttextures / Textranslate

Postby henrik_k » Tue Sep 25, 2018 9:57 pm

Thanks Ian,

I changed the axis setting and it worked, but only once! Then it was back moving the texture into the wrong x direction.
As I had copied the axis setting <y> -1 </y> from the example used in the Howto: "Industrial50x100.ac", I placed this building using UFO and the textures didn't change to night textures properly either!

Long story short: something apparently is not stable / correct with my FlightGear 2018.2.2 on Linux Ubuntu 18.04 LTS Bionic Beaver.
Running FlightGear 2018.2.2 under Windows 10 on the same computer, changing textures to night textures works fine (btw: even with the axis setting <y> -1 </y>)!

Anywhere I should report such issue?

Cheers, Henrik
henrik_k
 
Posts: 9
Joined: Sun Jun 03, 2018 8:53 pm
Location: Wiesbaden, Germany
OS: Win10/Ubuntu 18.4

Re: Nighttextures / Textranslate

Postby henrik_k » Fri Oct 05, 2018 8:15 pm

Made good progress with using lightmaps also for buildings, calling the effects file *.eff from the xml:
Code: Select all
<effect>
    <inherits-from>building_lightmap_eff</inherits-from>
    <object-name>building</object-name>
</effect>


and using the following code for the effects file:
Code: Select all
<PropertyList>
  <name>building_lightmap_eff</name>
  <inherits-from>/Effects/Building</inherits-from>
  <parameters>
   <normalmap-enabled type="int">0</normalmap-enabled>
    <reflection-enabled type="int">0</reflection-enabled>
    <reflection-dynamic type="int">0</reflection-dynamic>
    <reflect_map-enabled type="int">0</reflect_map-enabled>
    <reflection-correction type="float">0</reflection-correction>
   <lightmap-enabled type="int">
      <use>/environment/lightmap-factor</use>
   </lightmap-enabled>
   
    <texture n="3">
      <image>building_lightmap1.png</image>
    </texture>
  </parameters>
</PropertyList>


Creates indeed much better results than Textranslate!

However, here's the question:
The current upload form for static objects doesn't allow uploading more than one texture file (which I would need to do: (1) texture file plus (2) lightmap) nor the effects file. How could I upload / share static objects with lightmap functionality?
henrik_k
 
Posts: 9
Joined: Sun Jun 03, 2018 8:53 pm
Location: Wiesbaden, Germany
OS: Win10/Ubuntu 18.4

Re: Nighttextures / Textranslate

Postby Catalanoic » Fri Oct 05, 2018 10:43 pm

of course you can upload multiple texture files. maybe 1-2 basic texture with night part (with tranlate function), lightmap texture, etc.but try some numbering and names and keep low to mid resolution in factor of two.
User avatar
Catalanoic
 
Posts: 1099
Joined: Mon Mar 05, 2012 1:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2017.3
OS: Lubuntu/Windows 7

Re: Nighttextures / Textranslate

Postby henrik_k » Sat Oct 06, 2018 12:39 am

Hi Catalanoic, are you using the web-form?
https://scenery.flightgear.org/app.php? ... del&a=form

You are correct, it is possible to upload more than one texture file, but how do I upload the effects file (*.eff) required to trigger the shaders with the lightmap?
henrik_k
 
Posts: 9
Joined: Sun Jun 03, 2018 8:53 pm
Location: Wiesbaden, Germany
OS: Win10/Ubuntu 18.4

Re: Nighttextures / Textranslate

Postby wkitty42 » Sat Oct 06, 2018 5:12 pm

the effects file probably should go in FGData... especially if it is generic and can work with other objects of similar nature to the one you are working on...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9165
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: Nighttextures / Textranslate

Postby henrik_k » Sat Oct 06, 2018 9:13 pm

Thanks, wkitty42, the effects file is not generic, but specific to the static object, as it points to the specific lightmap for the object, see code posted also above:
<texture n="3">
<image>building_lightmap1.png</image>
</texture>

Please excuse my ignorance: if storing the effects fie in FGData is the solution, how do I get it there? The only way of uploading scenery objects that I am aware of is the input form on the scenery website...
henrik_k
 
Posts: 9
Joined: Sun Jun 03, 2018 8:53 pm
Location: Wiesbaden, Germany
OS: Win10/Ubuntu 18.4

Re: Nighttextures / Textranslate

Postby wkitty42 » Sun Oct 07, 2018 9:30 am

TBH, after some contemplation, i'm not sure which way would be the better way to go... i'll just shut up and let the scenery guys handle it...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9165
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: Nighttextures / Textranslate

Postby Catalanoic » Sun Oct 07, 2018 3:47 pm

I think all static object files need to be distributed through TerraSync. But if you think that file will be used for more objects, maybe hundreds or thousands you can upload it to main FGData and then call it throgh XML file. Maybe writing about that functionality to the FG developing mail list you can obtain a core-developer answer or comment. Link to suscribe the list: https://sourceforge.net/projects/flight ... gear-devel
User avatar
Catalanoic
 
Posts: 1099
Joined: Mon Mar 05, 2012 1:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2017.3
OS: Lubuntu/Windows 7

Re: Nighttextures / Textranslate

Postby Catalanoic » Tue Oct 09, 2018 11:29 pm

There is no other way than to use an effect to have single night texture file (lightmap), just like AI aircraft and OSMcity buildings (and the previous random building feature). It may work in these cases but isnt ideal for shared and static objects. Most games have dedicated lightmaps for the objects so i think it can't be hard to code an expression to this feature.
User avatar
Catalanoic
 
Posts: 1099
Joined: Mon Mar 05, 2012 1:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2017.3
OS: Lubuntu/Windows 7


Return to Scenery

Who is online

Users browsing this forum: No registered users and 4 guests