How to edit a shader's .cginc and .shader files?

Hi, I'm trying to edit this camera shader asset that I purchased from the asset store:

The shader draws these paint strokes all over what the camera sees, based on the pixel info underneath. I would like to change the shapes/textures of these brush strokes, for a different painting style.
I looked through the asset's files, but I couldn’t find any image files to edit. I assumed there would be some kind of texture sheet of brush strokes or vector files that the shader was pulling from. The only files I can find in the asset are in .cginc and .shader formats.


Is it possible that textures/sprite sheets are somehow compressed into these .cginc or .shader files? (I'm a relative Unity beginner and not familiar with how these files, and shaders in general, work.) What do I need to do/use to edit these brush shapes that the shader draws?

I appreciate any help in pointing me in the right direction. Thank you!

This all means that the shapes are generated procedurally - that is, using math.

Okay, thank you. How would I edit this procedural generation?

There is no simple answer to that question :)
You would need to understand how this specific shader works and then change the math to generate the shape you need.

I guess I should be more specific with my question: how are shaders edited? How do I open .cginc and .shader files? Is there a built in function to open and edit these in Unity? Or do I need some sort of additional asset or software tool to open up these files to make changes? Which program?

They're text files, with code written in HLSL and Unity's C#-like ShaderLab markup language. They can be opened up in any text editor or IDE like Notepad, Notepad++, Sublime Text, Atom, Visual Studio, Visual Studio Code, Rider, etc. (though don't expect any IDE to actually support proper code completion and the like, though Rider has supposedly made some strides there).

1 Like

Thank you for this very helpful answer!
From searching around I've seen mentions of packages like Shader Graph and Amplify Shader Editor, to make shaders in a more visual manner. Are such programs able to open pre-made shader files like these and edit them? Or do they use different working formats, and the .cginc and .shader files are just the final outputs?

Shader Graph and Amplify Shader Editor both use their own formats and output the equivalent of a .shader file for use with Unity. Amplify Shader Editor actually stores the node layout in a .shader file that includes the HLSL output, but as extra data that the regular shader parser ignores so the output can be used in projects that don’t have ASE can still use the shader file.

1 Like

Okay, thank you very much.

NotePad++, Shader syntax highlight