How to access a value via script?

Node-based Shader Editor

How to access a value via script?

Postby AndrewMyriad » Sun Sep 09, 2018 11:38 pm

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!
AndrewMyriad
 
Posts: 9
Joined: Wed Aug 08, 2018 1:57 am

Re: How to access a value via script?

Postby Ricardo Teixeira » Mon Sep 10, 2018 11:49 am

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!


Hello,

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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: How to access a value via script?

Postby AndrewMyriad » Tue Sep 11, 2018 2:19 am

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!
AndrewMyriad
 
Posts: 9
Joined: Wed Aug 08, 2018 1:57 am

Re: How to access a value via script?

Postby Ricardo Teixeira » Tue Sep 11, 2018 11:12 am

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!


Hope it works out!
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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 31 guests