Open TimPietrusky opened 4 years ago
The hidden part of the shader is here in the repo: https://github.com/shawnlawson/The_Force/blob/gh-pages/shaders/header.frag
Only parts of that are needed based on what you're using in main(). Uniforms would need to be renamed and matched with your target platform. I've seen several people use shaderToy this way and rewrite the code (Unity, Touchdesigner, etc) to match for easy plug 'n play. If you're familiar with uniforms and what's being passed around, then it's not too bad. Items like my back buffer (previous frame buffer) do not translate out because it's coded specifically in javascript to handle the FBOs. Things like this would be platform specific. For example, I have another version of this running in touchdesigner where I re-implemented the FBOs with their feedback nodes.
@shawnlawson so that means you would recommend writing a "how to migrate the code from The Force to another platform"? If yes, then I will try my best to contribute this.
I could see a couple approaches, but hopefully not too many specific use cases. One could be a documentation description of what the uniforms are and what they should connect to in the host application. Another could be a suite of python (or other language or built-in) scripts that parse the shader and pull what's needed from the header for a specific host application. Hmmm, that could be tuned to intelligently rename uniforms based on need. The documentation bit is the easiest, but relies on the end user having some GL knowhow. The other could be a more direct route for more users. Then I guess there's doing both. What kind of approach are you thinking? Once I get submitting grades this week, I'll have a lot more time. Shouldn't take more than a couple hours to write the doc part.
What kind of approach are you thinking?
Both sound good to me.
For me as a beginner with shaders, but with a development background, the documentation would be enough at first. But in the long run it would be a time-saver to have this automated so I can just use the enriched shader from The Force in other places and don't have to worry about copy / pasting the correct code and trying to find the correct documentation for the uniforms.
For others (especially beginners with no dev-background) the scripted solution would be the best.
Starting it here https://github.com/shawnlawson/The_Force/wiki/Exporting-Shaders
That is super helpful already, thank you very much!
It would be great to have a full export of a shader, so that the created file could also be used in other IDEs that don't come with the build-in functions as The Force does.
Use Case