GithubHelp home page GithubHelp logo

Comments (4)

halvves avatar halvves commented on May 17, 2024

Hey @bolinocroustibat. Unfortunately, there isn't currently a way to get the pixels of an iframe, let alone use them in a webgl texture (part of iframe/web security). You should, however, be able to use regular video files as textures.

<shader-doodle>
  <sd-texture src="video.mp4" name="video"></sd-texture>
  <script type="x-shader/x-fragment">
    uniform sampler2D video;

    void main() {
      vec2 uv = gl_FragCoord.xy / u_resolution.xy;
      vec4 texture = texture2D(video, uv);

      gl_FragColor = texture;
    }
  </script>
</shader-doodle>

Here is an example using <video> tags like you were asking for: https://github.com/halvves/shader-doodle/blob/master/demo/video-element.html

from shader-doodle.

bolinocroustibat avatar bolinocroustibat commented on May 17, 2024

Hi @halvves and thank you very much for your precise answer.

Yeah I was a bit afraid of that, and I saw shader-doodle had a way to work with video files - which is great. By the way, I really like this project. Unfortunately my use cases now are with YouTube embeds so I can't use it for those present uses cases 😢

However, in the meantime I did a few simple hacks, code removals on shader-doodle VHS effect in order to apply overlay textures shaders only: no cam/video shaders anymore, only texture ones applied on the top of the YouTube iframe/video tag. It's not as wonderful as the original shader-doodle VHS effect as it doesn't distort the video itself anymore, but still visually works quite ok as a VHS effect.

from shader-doodle.

halvves avatar halvves commented on May 17, 2024

@bolinocroustibat even though using a youtube embed as a texture is currently an impossibility, is there anything shader-doodle could to to make it more useful for just overlaying effects on an iframe/youtube embed?

from shader-doodle.

bolinocroustibat avatar bolinocroustibat commented on May 17, 2024

@halvves can't think about anything for now, but I wonder if we could integrate a non-full opacity CSS (canvas?) overlay on top of an embed video/iframe to be "shaderized". It's a bit what I did, but maybe it could be an integrated (and better) shader-doodle method so that we would only pass the iframe/video tag. Just a very broad general idea.

from shader-doodle.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.