Overriding shader functions

Did anyone ever figure out an elegant way of overriding functionality of an existing include file that is used by many built-in shaders? For example if I want a different light attenuation model.

The best I’ve come up with was to copy everything, add a compile directive to hide the original block of code and supply my own version, but it’s kinda messy.

For a global change like that yeah you need to edit the install’s cginc files and add your own defines. NGSS for example has an editor tool to automatically make their changes to the install files for its users. And you could even have your editor plugin check the files on startup and warn the user if the changes don’t exist in their currently open version.

@Invertex can you give more info on those files please?

You’re going to find all of those files where ever you have the editor itself installed. For example:
C:\Program Files\Unity\Hub\Editor<Version>\Editor\Data\CGIncludes\

1 Like