Shader perfrormance regardig Toggle Switch

Node-based Shader Editor
Post Reply
MajinKa
Posts: 5
Joined: Fri Nov 09, 2018 4:24 am

Shader perfrormance regardig Toggle Switch

Post by MajinKa »

Hello again!

Thanks once more for the awesome product and great support.

The matter can be best explained with the following example:
If I am using - Toggle Switch which, on 0 has a simple FLoat value to use as Albedo, and on 1 I have a complex network of operators, lerps and image processing… will the runtime performance be affected depending on the toggle?

In other words… what happens to the input of the toggle switch which isn’t passed?? Does it affect frame rate if it’s disabled?? Is it still computed??

Practical case: I’m developing a shader which permits the use image blending (overlay) and multiple leaped textures. I’m “enabling” the feature with a Toggle Switch. So what happens when the feature is disabled?? Should I be seeing an betterment in runtime performance??

Thank you so much beforehand!!!

And again, awesome product :) rated 5 stars!

-Rob
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Shader perfrormance regardig Toggle Switch

Post by Ricardo Teixeira »

MajinKa wrote:Hello again!

Thanks once more for the awesome product and great support.

The matter can be best explained with the following example:
If I am using - Toggle Switch which, on 0 has a simple FLoat value to use as Albedo, and on 1 I have a complex network of operators, lerps and image processing… will the runtime performance be affected depending on the toggle?

In other words… what happens to the input of the toggle switch which isn’t passed?? Does it affect frame rate if it’s disabled?? Is it still computed??

Practical case: I’m developing a shader which permits the use image blending (overlay) and multiple leaped textures. I’m “enabling” the feature with a Toggle Switch. So what happens when the feature is disabled?? Should I be seeing an betterment in runtime performance??

Thank you so much beforehand!!!

And again, awesome product :) rated 5 stars!

-Rob
Hello Rob,

Thank you for using ASE, and for your support!

The Toggle Switch has the same cost as a standard Lerp node, meaning that both inputs are calculated. For added control, you'll have to use the Static Switch.

Hope it helps, thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
MajinKa
Posts: 5
Joined: Fri Nov 09, 2018 4:24 am

Re: Shader perfrormance regardig Toggle Switch

Post by MajinKa »

Hey!! Thanks for the reply!

Absolutely and totally understood.
So a Toggle Switch is basically a Boolean keep.
Whereas the Statis Switch only calculates the input that is passed, righty??

I’ve successfully implemented Static Switches for expensive shader features, so I’ll ask further:

If I’m using a keyword on a static switch within a shader función which I’m invoking for a couple of different shaders, does it still count as a single keyword??
(I’m thinking about this regarding the 256 - 60 keyword limit… and the fact that I know for a fact I’m using other shaders in the project which also use keywords, so I wanna keep my created keyword count low)

Thank you so much!!!!

Cheers :)
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Shader perfrormance regardig Toggle Switch

Post by Amplify_Borba »

Hey there, each keyword should only count as one, independently of how often it is used in the project.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply