How to implement a ShaderToy shader in three.js?

前端 未结 3 740
有刺的猬
有刺的猬 2020-12-02 23:47

looking for info on how to recreate the ShaderToy parameters iGlobalTime, iChannel etc within threejs. I know that iGlobalTime is the time elapsed since the Shader started,

3条回答
  •  [愿得一人]
    2020-12-03 00:27

    This is an old thread, but there's now an automated way to do this. Simply go to http://shaderfrog.com/app/editor/new and on the top right click "Import > ShaderToy" and paste in the URL. If it's not public you can paste in the raw source code. Then you can save the shader (requires sign up, no email confirm), and click "Export > Three.js".

    You might need to tweak the parameters a little after import, but I hope to have this improved over time. For example, ShaderFrog doesn't support audio nor video inputs yet, but you can preview them with images instead.

    Proof of concept:

    ShaderToy https://www.shadertoy.com/view/MslGWN

    ShaderFrog http://shaderfrog.com/app/view/247

    Full disclosure: I am the author of this tool which I launched last week. I think this is a useful feature.

提交回复
热议问题