Page 1 of 1

Shader property shared between materials

PostPosted: Sat Feb 03, 2018 6:00 pm
by elettrozero
Sorry I cannot find how to setup a property that, once changed on one material, every other material using that shader gets that property the same value.
----
Edit: I think that what I need is a Global property but, by setting the value using Unity Script like this:
materialInstance.SetVector("_PlayerPosition", _transform.position);
doesn't do anithing.
Can you help me?

Re: Shader property shared between materials

PostPosted: Sat Feb 03, 2018 7:24 pm
by Ricardo Teixeira
elettrozero wrote:Sorry I cannot find how to setup a property that, once changed on one material, every other material using that shader gets that property the same value.
----
Edit: I think that what I need is a Global property but, by setting the value using Unity Script like this:
materialInstance.SetVector("_PlayerPosition", _transform.position);
doesn't do anithing.
Can you help me?



Hello,

Material properties are unique to each material, constants (default type) do apply to every material.

Be sure to check the Smear sample (AmplifyShaderEditor\Examples\Official\Smear), it does exactly what you are looking for; scripts included.

Be sure to let us know if you have any additional questions, we would be happy to help.

Thanks!