Page 1 of 1

Shader perfrormance regardig Toggle Switch

PostPosted: Sun Dec 02, 2018 10:08 pm
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

Re: Shader perfrormance regardig Toggle Switch

PostPosted: Mon Dec 03, 2018 11:23 am
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!

Re: Shader perfrormance regardig Toggle Switch

PostPosted: Tue Dec 04, 2018 2:38 am
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 :)

Re: Shader perfrormance regardig Toggle Switch

PostPosted: Mon Dec 10, 2018 11:54 am
by Amplify_Borba
Hey there, each keyword should only count as one, independently of how often it is used in the project.