passing variables from includes to shader

Node-based Shader Editor

passing variables from includes to shader

Postby cyble » Mon Jan 15, 2018 6:29 pm

Hi there,

I'm using a .cginc file to do some procedural stuff that's executed by instancing_options procedural:setup.
But now I need to access a variable from my .cginc from within amplify shader editor.

This is where I thought global variables should came in handy.
But all globals are declared after the include and therefore not seen by my include file.
Manually moving the global variable to the top solves the issue but is of course not very efficient doing this after each refresh of the shader :) .

Does someone know if there is another option I can pass data along from my include that I missed ?

Thank you,

Cheers,

Dennis
cyble
 
Posts: 2
Joined: Mon Jan 15, 2018 6:16 pm

Re: passing variables from includes to shader

Postby Amplify_Borba » Mon Jan 15, 2018 6:43 pm

Hello Dennis, thank you for getting in touch and for your support!

Have you added your .cginc file to the "Additional Inclues" in the Main Node properties?

Please refer to our Curved World example in the manual which exemplifies how to setup a .cginc file with ASE, and do let us know if this helps you out.

Looking forward to your reply!
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
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: passing variables from includes to shader

Postby cyble » Mon Jan 15, 2018 7:25 pm

Hi Amplify Borba!

Thank you for your answer. Didn't know about the custom expression node (much like the code node in shader forge which I missed until now) !

Which was exactly what I needed and is a much better solution for my problems in the long run too!

So all is working perfectly now and thanks again for your quick and helpful response!

cheers! :D
cyble
 
Posts: 2
Joined: Mon Jan 15, 2018 6:16 pm

Re: passing variables from includes to shader

Postby Amplify_Borba » Tue Jan 16, 2018 9:41 am

No worries, glad I could help you find a better solution!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback. Every bit helps, your feedback is extremely valuable to us.

Feel free to get back in touch if you have further questions, thanks!
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
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests

cron