+27
Completed

It should be possible to incorporate stuff from custom ".cginc" includes in code blocks.

Bob Aman 11 years ago updated by Freya Holmér (Developer) 8 years ago 6
Like, for example if I incorporate a custom Perlin noise include, I'd like to be able to drop that into a code block and just call turbulence(p, octaves) while still keeping the rapid prototyping of Shader Forge.

Answer

Answer
Completed

This is now supported in Shader Forge 1.36 :)
Apologies for the delay on this one!

+1
That is an awesome idea!  

It would be even more awesome if someday in the future Shader Forge could also be used to create the .cginc file.  For example, creating a file with the custom lighting that would be used instead of Phong, Blinn-Phong, etc. in future shaders.  And it would be awesome if a group of nodes could be saved so they could be re-used.  (I am assuming the group would be stored as a .cginc file.)
Planned
Generating .cginc files with SF seems a bit redundant, given that nested nodes will give you more or less the same functionality. But yeah, being able to include them is a good idea, and I'll do that at some point :)

This features can be implemented in 1.25?

my Addition to that topic would be the following possible solution:


A node that reads a ".cginc" file and presents a dropdown to import a specific function. The node should generate the input vars from the function definition and the rest can act like the code-node!?

I also would like to have this. There are some cases where this would be great:


1) If you have multiple shaders that use a large amount of the exact same code.

2) If you need to import a lot of code from one of Unity's builtin .cginc files

3) You want to split up your shader into individually editable parts.


One thing that would be nice is if there was an option in "Lighting", next to "Custom Lighting", called "cginc". Selecting this mode would disable the Main node entirely., and instead your shader will simply be written to a cginc file. This would make it easier to create cginc files with shader forge. Basically it would simply save all your code nodes, and any of your global variables and stuff, to the cginc file, and it would not create a shader (no frag or vert functions).

Answer
Completed

This is now supported in Shader Forge 1.36 :)
Apologies for the delay on this one!