Board index FlightGear Development Effects and shaders

I would like to make an object semi-transparent ...

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

I would like to make an object semi-transparent ...

Postby abassign » Mon Mar 27, 2017 9:38 am

I would like to make an object semi-transparent, without changing the properties of the file .ac !

I tray with belnd animation
http://wiki.flightgear.org/Howto:Animate_models#Blend

or with "Material animation" with the "Transparency" option, but I had no useful result!

I searched the forum, but I could not find anything useful.
Does anyone know what is the technique to use, in order to have transparency effects that NASAL or XML can dynamically change?
abassign
 
Posts: 706
Joined: Mon Feb 27, 2012 5:09 pm
Location: Bergamo - Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2016.3
OS: Linux Mint 17. x

Re: I would like to make an object semi-transparent ...

Postby Thorsten » Mon Mar 27, 2017 9:56 am

Try making the object transparent in the *.ac and set no transparency/ whatever you like transparency in the xml-wrapper via the material animation.

I'm not sure about the details, but graphics cards tend to decide whether an object is transparent early on, and once the GPU decides your object is not transparent, it'll ignore all attempts to set alpha later.

Also, make sure the object uses a transparent variant of an effect (if applicable to your problem).
Thorsten
 
Posts: 9468
Joined: Mon Nov 02, 2009 8:33 am

Re: I would like to make an object semi-transparent ...

Postby abassign » Mon Mar 27, 2017 12:20 pm

Thank you for your response, I found the problem:
Blend wants an expression or a property, otherwise it will not work!

For example, the property "sim/MyAirplane/glass_camera_reflections" is define by NASAL code, in this configuration the surfice from transparent become less transparent and the color is "Orange01.png"

Code: Select all
    <animation>
        <type>material</type>
        <object-name>Glass001</object-name>
        <texture>Liveries/Orange01.png</texture>
    </animation>

    <animation>
        <type>blend</type>
        <property>sim/MyAirplane/glass_camera_reflections</property>
        <factor>0.7</factor>
        <object-name>Glass001</object-name>
    </animation>


Thi is the NASAL code:

Code: Select all
# Calculate Glass reflection
var prop = props.globals.initNode("sim/MyAirplane/glass_camera_reflections", 0, "DOUBLE");
var timer = maketimer(1, func() {
    var ambientRedLight = props.globals.getNode("/rendering/scene/ambient/red",1);
    reflection = ambientRedLight.getValue();
    setprop("sim/MyAirplane/glass_camera_reflections",reflection);
});
timer.start();


In my case I wanted to reduce the orange color effect glass (it's an anti-reflective glass), when there is a decrease of ambient light:

Image
abassign
 
Posts: 706
Joined: Mon Feb 27, 2012 5:09 pm
Location: Bergamo - Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2016.3
OS: Linux Mint 17. x


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest