/ Import & Export shader with URL
Author: Theron Tarigo

This is the full description and with properly formatted links for Import / Export shader with URL (on Shadertoy)

A shader source may be embedded in a URL like this (example for a simple shader):

https://www.shadertoy.com/new#Shader=%7B%22ver%22%3A%220.1%22%2C%22renderpass%22%3A%5B%7B%22outputs%22%3A%5B%7B%22channel%22%3A0%2C%22id%22%3A%224dfGRr%22%7D%5D%2C%22inputs%22%3A%5B%5D%2C%22code%22%3A%22%23define%20mainImage(o%2Cu)%20o%2B%3Dsin(u.xyxy%2F9.%2BiTime)%22%2C%22name%22%3A%22Image%22%2C%22description%22%3A%22%22%2C%22type%22%3A%22image%22%7D%5D%2C%22flags%22%3A%7B%22mFlagVR%22%3Afalse%2C%22mFlagWebcam%22%3Afalse%2C%22mFlagSoundInput%22%3Afalse%2C%22mFlagSoundOutput%22%3Afalse%2C%22mFlagKeyboard%22%3Afalse%2C%22mFlagMultipass%22%3Afalse%2C%22mFlagMusicStream%22%3Afalse%7D%2C%22info%22%3A%7B%22id%22%3A%22-1%22%2C%22date%22%3A%221358124981%22%2C%22viewed%22%3A0%2C%22name%22%3A%22%22%2C%22username%22%3A%22None%22%2C%22description%22%3A%22%22%2C%22likes%22%3A0%2C%22hasliked%22%3A0%2C%22tags%22%3A%5B%5D%2C%22published%22%3A0%7D%7D

These URLs may be loaded into any Shadertoy tab with this javascript:

Shadertoy.com: Import source from URL (javascript) (bookmark this link)

(function(){var j=JSON.parse(decodeURIComponent(window.location.hash.slice(1).split('&').filter(r=>r.startsWith("Shader="))[0].slice(7)));j.info=gShaderToy.mInfo;gShaderToy.newScriptJSON(j);}())

The URL of a shader's source may be exported with this javascript:

Shadertoy.com: Export source to URL (javascript) (bookmark this link)

(function(){var j=gShaderToy.exportToJSON();j.renderpass[0].code="// copied from shadertoy.com/view/"+j.info.id+" by "+j.info.username+"\n\n"+j.renderpass[0].code;doAlert({mX:420,mY:300},{mX:800,mY:600},"Source as URL","<pre>"+htmlEntities("www.shadertoy.com/new\n#Shader="+encodeURIComponent(JSON.stringify(j)))+"</pre>");}())

You should check the webpage source or link target and have a basic understanding of the javascript to make sure I am not tricking you into harming your Shadertoy.com account. You should do this any time someone suggests you to run javascript code on another site, under any circumstance.

These links won't do anything on this page. You should bookmark them; then they may be used on Shadertoy.com shaders by clicking your bookmarks. Or you may copy the javascript codes to the browser console if you prefer.

If you'd like to overwrite an existing shader, copy only the resulting text beginning with "#" and append that to your target tab's URL:

www.shadertoy.com/new #Shader=%7B%22ver%22%3A%220.1%22%2C%22renderpass%22%3A%5B%7B%22outputs%22 . . .

https://www.shadertoy.com/view/wtSyRR#Shader=%7B%22ver%22%3A%220.1%22%2C%22 . . .