Babylon Quickie - EmissiveTexture

babylon

A common requirement is to use an image or texture with alpha on a plane.

Best Formats That Support Alpha

Still: PNG

Video: Webm (for HTML5), Cineform (for Davinci Resolve), Prores 444 (highend)

(My workflow is to output Cineform from Davinci Resolve then use FFMPEG to convert to Webm:

ffmpeg -i rw_video.mov -c:v libvpx-vp9 -pix_fmt yuva420p -an out.webm

Babylon Code Snippet

// Video Texture with alpha
var rw_mat = new BABYLON.StandardMaterial("mat", scene);                 // Make the material
var rw_texture = new BABYLON.VideoTexture("video", "rw_vid.webm", scene, true); // Make the texture to apply to material, 
rw_mat.emissiveTexture = bella_texture;     // set emissive texture
rw_mat.opacityTexture = bella_texture;      // set opacity
rw_mat.dsiableLighting = true;              // make sure light doesn't affect plane

myPlane.material = rw_mat;                 // apply the material to the plane