Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSuggestion: Documentation for shader chunks #17088
Comments
This comment has been minimized.
This comment has been minimized.
Recently, we've been considering switching to node based materials, and when that happens these docs would become obsolete. No idea when, or if, that's likely to happen though. |
This comment has been minimized.
This comment has been minimized.
At least the current implementation of three.js/examples/jsm/nodes/materials/nodes/StandardNode.js Lines 69 to 74 in d7dcf78 However, I think documenting |
This comment has been minimized.
This comment has been minimized.
|
I find that we can use string ‘void main() {‘ in most of shaders both for adding new uniforms and structs and for adding calculations inside main() function. Since .onBeforeCompile() looks like hack, we can describe this hack too. |
This comment has been minimized.
This comment has been minimized.
|
Shader chunks have existed for a long time, and may not be going anywhere in the near future. It would be nice to document them. +1 However, this can also be done outside of the core/repo. While a node based system might require documentation for something like |


It's a very common occurrence, on the forums/SO, to stumble by people having difficulties integrating existing shader chunks with their own custom shaders.
Most of the problem lies in the lack of a documentation for these. Having to dig through each chunk, determine each of their dependencies and required defines/uniforms makes it for quite a bit of work.
I'm sure it has been considered before, but is there any good reasons for not having these docs, besides being a lot of work? Finding a good way to organize the documentation could be tricky, but having this sort of information available is bound to be beneficial in the long run.
I would be more than happy to contribute with the creation of the documents, given that we can find an appropriated way of organizing and showcasing all the information required for each chunk. I think this is an all or nothing kind of deal.
Interested in hearing thoughts about this and possible counter arguments against having these docs.