Page 1 of 1

Query Mask Clip value within the shader

PostPosted: Sat Sep 22, 2018 11:58 pm
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

Re: Query Mask Clip value within the shader

PostPosted: Mon Sep 24, 2018 10:05 am
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!

Re: Query Mask Clip value within the shader

PostPosted: Tue Sep 25, 2018 12:22 am
by sethhall
Ahhh! Perfect. This is exactly what I was looking for :D .. Thank you.

Seth

Re: Query Mask Clip value within the shader

PostPosted: Tue Sep 25, 2018 7:38 am
by Amplify_Borba
Glad to know, please don't hesitate to get back in touch if you have any further questions, thanks!

Re: Query Mask Clip value within the shader

PostPosted: Sat Jan 26, 2019 5:42 pm
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=19od3DoIU3DPQBfGeMEXXQ5oTV0CgIE-M

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

Seth

Re: Query Mask Clip value within the shader

PostPosted: Tue Jan 29, 2019 10:41 am
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.