www.xbdev.net
xbdev - software development
Sunday April 20, 2025
Home | Contact | Support | WebGPU Graphics and Compute ...
     
 

WebGPU/WGSL Tutorials and Articles

Graphics and Compute ...

 

Video to WebGPU Texture in Real-Time


How to have live video frames copied to a in scene texture.


Screenshot of the output from the Example - showing an animated video getting mapped in real-time to the texture (burning cube).
Screenshot of the output from the Example - showing an animated video getting mapped in real-time to the texture (burning cube).



Important lines needed to modify an ordinary 2d texture so its content are updated from a video.

Summary


• Fragment shader: needs to use
texture_external

• Fragment shader access the color:
textureSampleBaseClampToEdge

• Body code (key lines):

const video document.createElement('video');
  
video.loop true;
  
video.autoplay true;
  
video.muted true;
  
video.src 'https://webgpulab.xbdev.net/var/resources/fire.mp4';
  
await video.play();
  ...
  const 
externalTextureSource = new VideoFrame(video);
  ...
  {   
binding2,  resourcedevice.importExternalTexture({sourceexternalTextureSource}) }




Resources


• Live example (with code) [LINK]





















101 WebGPU Programming Projects. WebGPU Development Pixels - coding fragment shaders from post processing to ray tracing! WebGPU by Example: Fractals, Image Effects, Ray-Tracing, Procedural Geometry, 2D/3D, Particles, Simulations WebGPU Games WGSL 2d 3d interactive web-based fun learning WebGPU Compute WebGPU API - Owners WebGPU Development Cookbook - coding recipes for all your webgpu needs! WebGPU & WGSL Essentials: A Hands-On Approach to Interactive Graphics, Games, 2D Interfaces, 3D Meshes, Animation, Security and Production Kenwright graphics and animations using the webgpu api 12 week course kenwright learn webgpu api kenwright programming compute and graphics applications with html5 and webgpu api kenwright real-time 3d graphics with webgpu kenwright webgpu for dummies kenwright webgpu wgsl compute graphics all in one kenwright webgpu api develompent a quick start guide kenwright webgpu by example 2022 kenwright webgpu gems kenwright webgpu interactive compute and graphics visualization cookbook kenwright wgsl webgpu shading language cookbook kenwright WebGPU Shader Language Development: Vertex, Fragment, Compute Shaders for Programmers Kenwright WGSL Fundamentals book kenwright WebGPU Data Visualization Cookbook kenwright Special Effects Programming with WebGPU kenwright WebGPU Programming Guide: Interactive Graphics and Compute Programming with WebGPU & WGSL kenwright Ray-Tracing with WebGPU kenwright



 
Advert (Support Website)

 
 Visitor:
Copyright (c) 2002-2025 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.