Maybe this shader is a good example. You see in the fragment shader how the chunk
common is included. After that, it’s possible to use the function
linearToRelativeLuminance() in the code.
Let’s say you have developed your shader program. If you want to use it in your
three.js app as a material, you have to create an instance of
RawShaderMaterial with your shader code. The following official example illustrates this workflow:
Also check the docs for more information.