|
I am wondering how I can create my own shader include file (.cginc or .glslinc), I want to reuse my shader code in many different shaders, and a personalized include file could help me in this regard.
(comments are locked)
|
|
This is what I found out:
Generally you probably want to put include guards (#ifndef) in your file, else it might not work in more than one file, which sort of beats the purpose.
You can place it anywhere in your Assets folder. Accesing it from the shader can the be done by writing either of the two lines of code below:
(comments are locked)
|
|
The content of the "included" file is just pasted into the original file. So you can write pretty much anything in there, as long as it's still meaningful when pasted into original shaders. Where to put it: best probably is next to the shaders (in the same folder). If it's in a different folder, use relative path to include it.
(comments are locked)
|
