Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full export that also includes all build-in functions which are not part of GLSL #24

Open
TimPietrusky opened this issue May 3, 2020 · 6 comments

Comments

@TimPietrusky
Copy link

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

  • Create a shader in The Force
  • Export the shader and import it into https://github.com/vcync/modV
  • Add parameters and use it for visual performances
@shawnlawson
Copy link
Owner

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.

@TimPietrusky
Copy link
Author

@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.

@shawnlawson
Copy link
Owner

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.

@TimPietrusky
Copy link
Author

TimPietrusky commented May 6, 2020

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.

@shawnlawson
Copy link
Owner

Starting it here https://github.com/shawnlawson/The_Force/wiki/Exporting-Shaders

@TimPietrusky
Copy link
Author

That is super helpful already, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants