Board index FlightGear Development Effects and shaders

Having some trouble with shadow volume

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

Having some trouble with shadow volume

Postby Necolatis » Mon Dec 12, 2016 7:52 pm

I am considering to put a shadow volume on the Viggen. (if I end up with something that will still make the plane compatible with older FG versions)

So I followed the instructions on the wiki.

It looks good, but when ever I get above 24 meters agl, the shadow disappears, as can be seen in this screenie it is in progress of going away here:

Image

Is there any way to set it to work at higher altitudes?

Secondly, there is some part of the shadow volume that seems to not having got the black color: (around engine)

Image

If I make the volume single-sided the artifact goes away, but then I also cannot see the shadow from the nozzle.

Also the shadow seems to be pitch black all the time, in the 172p is is grey, so I must have done something wrong.

The shadow volume only has 2 objects, the plane and the droptank. It is double sided and has no textures attached.

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

<PropertyList>

   <path>shadow-vol-ja37.ac</path>

   <effect>
       <inherits-from>Effects/shadow-vol</inherits-from>
       <object-name>shadow-vol</object-name>
       <object-name>shadow-vol-tank</object-name>
   </effect>

   <animation>
       <object-name>shadow-vol</object-name>
        <type>select</type>
        <condition>
                <not>
                    <property>/sim/rendering/rembrandt/enabled</property>
                </not>
                <equals>
                   <property>/sim/rendering/shaders/skydome</property>
                   <value>1</value>
            </equals>
        </condition>
    </animation>

    <animation>
       <object-name>shadow-vol-tank</object-name>
        <type>select</type>
        <condition>
                <not>
                    <property>/sim/rendering/rembrandt/enabled</property>
                </not>
                <equals>
                   <property>/sim/rendering/shaders/skydome</property>
                   <value>1</value>
            </equals>
                <equals>
                <property>sim/multiplay/generic/int[16]</property><!-- consumables/fuel/tank[8]/jettisoned -->
                <value>0</value>
            </equals>
        </condition>
    </animation>

    <animation>
        <type>noshadow</type>
       <object-name>shadow-vol</object-name>
       <object-name>shadow-vol-tank</object-name>
    </animation>

   <!-- Pitch -->
    <animation>
        <type>rotate</type>
       <object-name>shadow-vol</object-name>
       <object-name>shadow-vol-tank</object-name>
        <property>/orientation/pitch-deg</property>
        <factor>-1.0</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>

    <!-- Roll -->
    <animation>
        <type>rotate</type>
       <object-name>shadow-vol</object-name>
       <object-name>shadow-vol-tank</object-name>
        <property>/orientation/roll-deg</property>
        <factor>1.0</factor>
        <center>
            <x-m>0</x-m>
            <y-m>0</y-m>
            <z-m>0</z-m>
        </center>
        <axis>
            <x>1</x>
            <y>0</y>
            <z>0</z>
        </axis>
    </animation>

</PropertyList>   


Am using 2016.4.3 on win 10. Geforce 550 Ti
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Having some trouble with shadow volume

Postby wlbragg » Mon Dec 12, 2016 8:14 pm

The solid black shadow is actually the way it is designed to be. A hack was discovered where you add trans 0.0001 in the .ac to get it to be a transparent shadow. Beware that that has its own issues with layers showing instead of a single uniform shadow.

if I end up with something that will still make the plane compatible with older FG versions

When the c172p was first set up with the volume shadow it already had both a non-ALS and ALS shadow for backwards compatibility. It required two shadow.xml files and two shadow.ac files, so it can be done. At one point you could choose any of the three types of shadows.

I also recall having an issue with white artifacts before. I suggest you remake the mesh and keep it as simple as possible. Before you do that try assigning only this one material to the mesh.
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.0001


The disappearance of the shadow at altitude is also another know bug or issue. Is it constant, when it disappears, at every location or does it do it intermittently?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Having some trouble with shadow volume

Postby wlbragg » Mon Dec 12, 2016 8:19 pm

Is there any way to set it to work at higher altitudes?

More than likely it is a fault in the filter calculation (rounding or something) and it is sinking below the ground. At higher altitudes you could change the computation of the filter to raise the shadow further off the ground. Because of your altitude you wouldn't be able to notice that it isn't on the deck.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Having some trouble with shadow volume

Postby Necolatis » Mon Dec 12, 2016 8:31 pm

Thank you.

After some experimentation, I think I prefer it black to seeing those layers.

Ok, will try to redo the mesh.

It seems to be constant that the shadow goes away at altitude.

Ahhh, clever. Will try to modify the filter then.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Having some trouble with shadow volume

Postby flug » Sun Mar 19, 2017 1:29 pm

Necolatis wrote in Mon Dec 12, 2016 8:31 pm:It seems to be constant that the shadow goes away at altitude.


I think it is because as part of the main aircraft model it is rendered by the near camera and the distance is the furthest distance that camera will show. I'm not sure how to work around this.

I've been able to see it as high as maybe 300-400 feet but no higher.

The only trick I can think of to keep it visible would be to put a limit on the distance at whatever the distance is that it disappears, and then scale the model down to simulate how it would look at a yet further distance.

Might be better (or easier, anyway) to just fade it out gracefully when it gets close to the nonfunctional distance.
flug
 
Posts: 219
Joined: Wed Jun 17, 2009 2:06 am


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests