Query Mask Clip value within the shader

Node-based Shader Editor
Post Reply
sethhall
Posts: 20
Joined: Mon Jun 25, 2018 11:09 pm

Query Mask Clip value within the shader

Post by sethhall »

Hi,

I'm working some Opacity Mask stuff and am trying to use the Mask Clip parameter. When I plug a node into the Shader.OpacityMask attribute I see that the 'Mask Clip Value' parameter shows up in the Inspector.

Is there any way to query that parameter? There is the 'Template Parameter' node but unlike teh Particle Texture, I can't use it to template the Mask Clip. That being said, is there any way to access this value within the shader itself?

Thanks,

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

Re: Query Mask Clip value within the shader

Post by Amplify_Borba »

Hello Seth!

The Template Parameter node is only meant to be used within templates, to access shader properties and global variables declared over the current template shader.

In the Surface shader, you can either create a Float property with its Property Name set according to the shader property you want to access, the Type set to 'Global' and the Variable Mode to 'Fetch', as per the example below:

Image

Or you can configure the Mask Clip Value by a custom shader property, which will allow you to access its value through the node you set up for this effect:

Image

Please let me know if this helps, 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!
sethhall
Posts: 20
Joined: Mon Jun 25, 2018 11:09 pm

Re: Query Mask Clip value within the shader

Post by sethhall »

Ahhh! Perfect. This is exactly what I was looking for :D .. Thank you.

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

Re: Query Mask Clip value within the shader

Post by Amplify_Borba »

Glad to know, please don't hesitate to get back in touch if you have any 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!
sethhall
Posts: 20
Joined: Mon Jun 25, 2018 11:09 pm

Re: Query Mask Clip value within the shader

Post by sethhall »

I am still struggling a bit with properly driving the Mask Clip Value to suit my needs. I have tried to parameterize it via the instructions above but I need the ability do reference a variable in these slots instead of just properties.

https://drive.google.com/open?id=19od3D ... oTV0CgIE-M

These slots where I can override what is currently here, is it possible to reference shader variables?

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

Re: Query Mask Clip value within the shader

Post by Amplify_Borba »

I don't think I fully understood the issue but, according to the screenshot, you're currently using inline properties in the Z Offset and you should follow that same procedure for the Mask Clip Value.

Do note that the clip is done when the Alpha minus the Mask Clip Value is less than or equal to 0.
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