简体   繁体   中英

How does WebcamToy get weird effects on top of getUserMedia() webcam video?

I know how to access the webcam using getUserMedia() in Javascript. However, I am impressed by all the effects that have been added in webcamtoy.com - especially effects such as "Top mirror", "Tunnel", "Shuffle" and so on. It seems like these are not plain CSS filters [1]. It is impressive to see them working "live" in the browser.

I am wondering if anyone here knows what the technique used is? .. and if there are any websites which explain how this can be done?

[1] https://webrtc.github.io/samples/src/content/getusermedia/filter/

I figured out a way to do it. The idea is to setup a WebGL canvas and use the webcam as the source for the texture. Then weird effects can be added by modifying the fragment shader.

I am testing the technique here: https://www.html5fun.com/webgl/webglswirl2.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM