Amplifying your potential.
Page 1 of 1

Random glitch

PostPosted: Wed Dec 06, 2017 10:56 am
by ePiQue
Hi everyone ,

I'm currently working on an hologram shader with random time glitch effect. The thing is, I have the glitch effect appearing but everytime at the same time :/ Any help would be greatly appreciated ! Thanks.

Re: Random glitch

PostPosted: Wed Dec 06, 2017 2:37 pm
by Amplify_Borba
Hello ePiQue, thank you for getting in touch and for your support!

Unfortunately, it's not possible to generate random values within a shader, but there are a few solutions you may use to bypass this limitation.

You may generate random numbers via script and pass them to the shader through global variables, please check our Smear sample which makes use of that feature at AmplifyShaderEditor/Examples/Official/Smear.

To give a feeling of randomness, it's common to use the vertices object or world position with time to drive a series of basic wave functions like Sin and Cos, the Bubble sample at AmplifyShaderEditor/Examples/Official/ReflectRefractSoapBubble is a suitable example.

Lastly, take a look at our Noise Generator node, even though it's a bit expensive it can also be useful for this use.

Please let us know if this information helped you out, thanks!

Re: Random glitch

PostPosted: Thu Dec 07, 2017 2:37 pm
by ePiQue
Thanks a lot Borba for this quick and very helpful reply !
I just finished my shader with the global variables you were talking about :D

Re: Random glitch

PostPosted: Thu Dec 07, 2017 4:06 pm
by Amplify_Borba
Not a problem, happy that the provided information was useful!

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!

If you have any further questions don't hesitate to get back in touch, thanks!