Hi there,
Is there a way to access a value that's being calculated by a shader at runtime (that isn't an input value that can be set to Property)?
For example I'm using sine of time and remapping the values to within a certain range to alter a value over time in my shader. I'm wanting to access via script what the result of those calculations are at any given time to affect something else. All I've been able to find so far is accessing values that are set to Property which are used as inputs via script, not the result of something being calculated within the shader.
Thanks!
How to access a value via script?
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: How to access a value via script?
Hello,AndrewMyriad wrote:Hi there,
Is there a way to access a value that's being calculated by a shader at runtime (that isn't an input value that can be set to Property)?
For example I'm using sine of time and remapping the values to within a certain range to alter a value over time in my shader. I'm wanting to access via script what the result of those calculations are at any given time to affect something else. All I've been able to find so far is accessing values that are set to Property which are used as inputs via script, not the result of something being calculated within the shader.
Thanks!
I don't believe that's possible with the currently provided shader types, with or without ASE. Perhaps with Compute Shaders, which we don't currently support, but I don't recommend it.
What type of shader are you trying to build, and why not pass the Sine Time value directly to the shader instead of the other way around?
Looking forward to your reply, 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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
- Posts: 9
- Joined: Wed Aug 08, 2018 1:57 am
Re: How to access a value via script?
Thanks for the reply! It's just a pulsating light effect on an object and another team member handling audio wanted to be able to access the intensity to be able to reference that pulse timing.
I hadn't considered using a script to calculate the intensity and then passing that into the shader instead of trying to pull the calculated value out from the shader, that makes a lot of sense. Will definitely give that a go.
Thanks!
I hadn't considered using a script to calculate the intensity and then passing that into the shader instead of trying to pull the calculated value out from the shader, that makes a lot of sense. Will definitely give that a go.

Thanks!
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: How to access a value via script?
Hope it works out!AndrewMyriad wrote:Thanks for the reply! It's just a pulsating light effect on an object and another team member handling audio wanted to be able to access the intensity to be able to reference that pulse timing.
I hadn't considered using a script to calculate the intensity and then passing that into the shader instead of trying to pull the calculated value out from the shader, that makes a lot of sense. Will definitely give that a go.
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!