Hi,
I’m trying to set a video for a model using a CustomShader,
but I don’t understand how to create a UniformTexture for a video correctly.
const videoElement = document.getElementById("video");
const videoTextureShader = new Cesium.CustomShader({
uniforms: {
// user-defined texture
u_video: {
type: Cesium.UniformType.SAMPLER_2D,
value: new Cesium.TextureUniform({
url: videoElement,
}),
},
},
// Apply the texture to the model, but move the texture coordinates
// a bit over time so it's animated.
fragmentShaderText: `
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
material.diffuse = texture(u_video, fsInput.attributes.texCoord_0).rgb;
}
`,
});