Visible vs opacity

Peer support for Air Manager desktop users

Moderators: Ralph, russ

Post Reply
Message
Author
a533
Posts: 14
Joined: Fri Apr 09, 2021 3:25 pm

Visible vs opacity

#1 Post by a533 » Sun Apr 11, 2021 3:45 pm

Hi

In terms of performance, fps and cpu usage is the same opacity( my_canvas,0) than visible(my_canvas,false) ?

What about "images" and other nodes?

Thank you and regards,

Alvaro

User avatar
Ralph
Posts: 4912
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Visible vs opacity

#2 Post by Ralph » Sun Apr 11, 2021 4:36 pm

Besides the performance, they both serve a different purpose, so why would you want go for a opacity if you're only going from invisible to visible?

User avatar
Keith Baxter
Posts: 2715
Joined: Wed Dec 20, 2017 11:00 am
Location: South Africa

Re: Visible vs opacity

#3 Post by Keith Baxter » Sun Apr 11, 2021 5:15 pm

Hi,

Performance is not gauged by fps.

The less expensive on cpu & memory is canvase_draw()
The most expensive on cpu & memory is Img_add()

If you look in the API you will notice a <remove(myimage)>

This came about due to many images been loaded and crashing AM.
It is good practice to remove an image when not in use, than to make it visible or not.

Keith
AMD RAZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Corjan
Posts: 2348
Joined: Thu Nov 19, 2015 9:04 am

Re: Visible vs opacity

#4 Post by Corjan » Sun Apr 11, 2021 5:54 pm

a533 wrote:
Sun Apr 11, 2021 3:45 pm
Hi

In terms of performance, fps and cpu usage is the same opacity( my_canvas,0) than visible(my_canvas,false) ?

What about "images" and other nodes?

Thank you and regards,

Alvaro
Hi,


If you do a visible(false), you are effectively telling Air Manager to ignore that node. This takes no CPU or GPU time.
If you do a opacity(0.0), the node is still processed by the CPU and drawn by the GPU. Obviously, nothing will be visible visually, but it is still processed.


Note that opacity is still very very fast and hardly is a hit on both CPU and GPU sides,

Corjan

User avatar
Corjan
Posts: 2348
Joined: Thu Nov 19, 2015 9:04 am

Re: Visible vs opacity

#5 Post by Corjan » Sun Apr 11, 2021 5:58 pm

Keith Baxter wrote:
Sun Apr 11, 2021 5:15 pm
Hi,

Performance is not gauged by fps.

The less expensive on cpu & memory is canvase_draw()
The most expensive on cpu & memory is Img_add()

If you look in the API you will notice a <remove(myimage)>

This came about due to many images been loaded and crashing AM.
It is good practice to remove an image when not in use, than to make it visible or not.

Keith
Hi,


This is not true.

Images take very little CPU time (since no real calculations have to be done, the CPU simply tells the GPU to draw a bunch of pixels), but can be quite taxing on the GPU.
Canvasses on the other hand are more CPU intensive, but tend to be less taxing on the GPU.
It is dependent on quite some factors (size, number of canvas operations etc.).

In general, you don't have to worry about using the 'remove' function, GPU right now have a lot of memory. It might come in play when you are dynamically loading/unloading images, when you are using a moving map for instance.


Corjan

User avatar
Keith Baxter
Posts: 2715
Joined: Wed Dec 20, 2017 11:00 am
Location: South Africa

Re: Visible vs opacity

#6 Post by Keith Baxter » Sun Apr 11, 2021 8:13 pm

@Corjan

My misunderstanding.

The G1000 I am developing has to date has some 4382 canvas_add()'s most 1920x1080 in size.
There are a few that are large. 360000 x 180000.

All the canvases are not drawn but have to be declared on initialization.
If I do not remove unused images and canvases then AM crashes or go's unresponsive. So I make a point of habit to remove() everything not used.

I have tried using and moving large images 360000 x 180000. AM does not like that.
AM does not have an issue with a canvas_draw() this size.

Hence my response.

Keith
AMD RAZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

a533
Posts: 14
Joined: Fri Apr 09, 2021 3:25 pm

Re: Visible vs opacity

#7 Post by a533 » Sun Apr 11, 2021 9:23 pm

Thank you for your answers, then I'll put


if opacity_value < .05 then
visible( my_canvas , false )
else
visible( my_canvas , true )
opacity( my_canvas , opacity_value )
end

Regards

User avatar
Keith Baxter
Posts: 2715
Joined: Wed Dec 20, 2017 11:00 am
Location: South Africa

Re: Visible vs opacity

#8 Post by Keith Baxter » Sun Apr 11, 2021 9:32 pm

Hi,

You can just do this. No need for if ..else statements.

Code: Select all

opacity( my_canvas , opacity_value )
visible( my_canvas , opacity_value > 0.05)

Keith
AMD RAZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests