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 10: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?
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

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

Postby Thorsten » Mon Mar 27, 2017 10: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: 12490
Joined: Mon Nov 02, 2009 9:33 am

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

Postby abassign » Mon Mar 27, 2017 1: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
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 9 guests