→ and now for the “Mr Annoying” follow-up (but still relevant):
The actual reason for me - to ask for GLB - was that I had a “Retro TV” GLB-model that could show a video-texture on a Screen (this Screen is part of the GLB-heirarchy).
Before going any further (example-wise): It seems like neither Plane or Model assets, can execute video-textures, for then to be a functional part of a/this Stencil-rendering above?
back: both mp4 - so at first it looked like an issue in relation to size (youStar’s example 4 mb mine 159 mb), but then I compared the actual attached scripts
My setup from another forked example (it works in other cases):
not sure if I have ‘the nerd time’ to dig deep into the variation, but at least the last setup works with both video sizes now (namely while using the last forked)
The issue for you is that in _setStencilForModel it creates a clone of the material per mesh instance for objects that render in/out of the stencil.
StencilSubject.prototype._setStencilForModel = function (stencil) {
for (var i = 0; i < this._meshInstances.length; i++) {
this._meshInstances[i].layer = this.app.scene.layers.getLayerByName('Before World');
var mat = this._meshInstances[i].material.clone();
mat.stencilBack = mat.stencilFront = stencil;
this._meshInstances[i].material = mat;
}
};
In the default script for the video textures, the video texture is set on the original material, not the cloned one.
In my version of the video texture script that I tweaked to make it simpler to use for the example in this thread, I set the video texture before the clone, hence it works.