Board index FlightGear Development Scenery

I have a building with a lightmap, but...

Questions and discussion about enhancing and populating the FlightGear world.

I have a building with a lightmap, but...

Postby legoboyvdlp » Fri Jan 29, 2016 1:37 pm

I have a building with a lightmap.
It looks really ugly in the daytime, as the lightmap is fairly dark; it just looks too dark in the day. It looks nice at night, however.

I was wondering -- how could I make the model use the lightmap texture at night, but the ordinary texture in the day?

Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<PropertyList>

  <path>KIC_hangar.ac</path>
 
  <effect>
    <inherits-from>/Effects/model-combined-deferred</inherits-from>
    <parameters>
      <lightmap-enabled type="int">1</lightmap-enabled>
      <texture n="3">
   <image>KIC_hangar_lightmap.png</image>
      </texture>
    </parameters>
    <object-name>KIC_hangar</object-name>
  </effect>

</PropertyList>
-- my .xml

Then I have the .ac and two texture files.

Cheers!
User avatar
legoboyvdlp
 
Posts: 6718
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: I have a building with a lightmap, but...

Postby legoboyvdlp » Sat Jan 30, 2016 1:51 am

I hate to bump this, but I only have a couple of months, and I have a whole lot more buildings to make and texture. And I am just learning Blender.

What I need in a sentence is for the building to use the lightmap texture at night, but the ordinary texture in the day.
User avatar
legoboyvdlp
 
Posts: 6718
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: I have a building with a lightmap, but...

Postby pommesschranke » Sat Jan 30, 2016 5:56 am

<animation> <type>...</type> <object-name>Light</object-name> <condition> <greater-than> <property>/sim/time/sun-angle-rad</property> <value>1.57</value> </greater-than> </condition> ...
pommesschranke
 
Posts: 1104
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 18.04

Re: I have a building with a lightmap, but...

Postby Thorsten » Sat Jan 30, 2016 6:44 am

Okay, I'm not getting it - if you have something with a lightmap, how can it look dark during the day even when the lightmap is on? After all, the lightmap is added to the normal light in the scene rather than replacing it - so anything with a lightmap should be unconditionally brighter than the same object without lightmap.

In other words - the lightmap is not a texture with light spots drawn on it which is mixed with the normal texture, the lightmap is only encoding the light that falls onto the texture.

The key would seem to feed the right control parameter to the lightmap strength - I think an <expression> based on the sun angle would be the most flexible tool, a <condition> is basically just and on-off switch, and they don't actually work for effects in the first place.
Thorsten
 
Posts: 10638
Joined: Mon Nov 02, 2009 8:33 am

Re: I have a building with a lightmap, but...

Postby legoboyvdlp » Sat Jan 30, 2016 1:35 pm

Ah! Thank you for your explanation, both of you.

I will do my best this mornig.
User avatar
legoboyvdlp
 
Posts: 6718
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: I have a building with a lightmap, but...

Postby legoboyvdlp » Sat Jan 30, 2016 3:16 pm

It is fine now -- thanks :)
User avatar
legoboyvdlp
 
Posts: 6718
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: I have a building with a lightmap, but...

Postby Harald » Sun Feb 14, 2016 10:30 am

Can you post your code please ?

I can not make it work with an expression :

Code: Select all
  <effect>
    <inherits-from>Effects/model-combined-deferred</inherits-from>
    <parameters>
        <lightmap-enabled type="int">1</lightmap-enabled>
        <texture n="3">
            <image>lfga-tower2.png</image>
         <type>2d</type>
         <filter>linear-mipmap-linear</filter>
         <wrap-s>clamp</wrap-s>
         <wrap-t>clamp</wrap-t>
         <internal-format>normalized</internal-format>
        </texture>
      <lightmap-factor type="float" n="0">
         <expression>
            <difference>
               <value>1</value>
               <property>/rendering/scene/diffuse/red</property>
            </difference>
         </expression>
      </lightmap-factor>
      <!-- will work some days... -->
      <!--lightmap-color type="vec3d" n="0"> 1.0 1.0 1.0 </lightmap-color-->
    </parameters>
    <object-name>toweranex</object-name>
    <object-name>tower</object-name>
  </effect>

I get random blinking.
Harald
 
Posts: 188
Joined: Fri Mar 02, 2007 4:30 pm
Location: Strasbourg, France
Version: nightly
OS: Windows 10


Return to Scenery

Who is online

Users browsing this forum: No registered users and 1 guest