You can take an example from shadertoy (e.g. Shader - Shadertoy BETA ) and customize it.
You can see how this works in the collection.
Use * discourse.threejs.hofk.de go to ShaderBeginner
below:
At shadertoy there are predefined shader inputs which can be expanded above the code. The output fragColor is to be replaced for three.js shader by gl_FragColor. In the examples with code from shadertoy the necessary changes are marked by comments // added hofk or // changed hofk.
then shader1, examples at the bottom.