Video texture loading when in view

Hello,

I’m working on a scene with around 50 video textures. I obviously had to downsize every one of those because it messed with everything (wouldn’t even load sometimes). Is it possible to add a feature where the texture is at first an image (first frame of the video for example) and becomes a video texture when it’s in the viewport? I could do it with a “proximity detector” and change it with JS but it’s going to take too much time.

Maybe you also have another idea? Right now we’re gonna change every video texture to an image because downsizing the videos makes it very ugly if we want it to be fluid.

I think this is a feature that could help a lot with performances on big scenes like that.

Thanks a lot

1 Like

We don’t have plans for such optimizations. Do you use the Video texture control extension to play videos only as a result of some user action? If a video is paused by default, it should show the first frame as a texture and do not consume bandwidth until it is played. I wonder if you had the 50 videos paused by default if it would also give performance problems.

They were all playing at the same time indeed. We tried reducing every video’s size by cutting to the first 15 seconds and some using xmedia recode. The performance were okay-ish (a little laggy but could deal with it) on a high end pc but really poor on apple devices (tested on 7 differents devices : macs, iphones, ipads).

We finally opted for a picture with a play button on it and a pop up with the full video, more user friendly.

I’m going to send this scene file to the support in the next few days to report a few other bugs, I can PM it to you too if you want to check it out !

If you don’t plan on doing it, I’ll try to see if I can make something with JS. Is there a way to get an object’s coordinates in space? In the same way as the getCameraPosition() function.

Thank you

JavaScript API doesn’t expose object’s coordinates. Perhaps you could maintain a list of bounding boxes in your JavaScript code together with a list of video textures that should be active within each bounding box? Then you could test if camera coordinates are within a box.

Another idea, although it is quite a lot of work and I’m not aware of anyone trying it so far, is to reduce the number of videos by putting multiple such videos in a single video file, one placed next to another and using texture UV mapping to address only relevant part of such video. Browsers could better handle a couple of larger video files than 50 small videos.

1 Like

JavaScript API doesn’t expose object’s coordinates. Perhaps you could maintain a list of bounding boxes in your JavaScript code together with a list of video textures that should be active within each bounding box? Then you could test if camera coordinates are within a box.

That’s exactly what I had in mind :slight_smile: Except that I wanted to make the bounding boxes’ list “automatically” with a script (so it’s faster for future projects !).

The other idea doesn’t sound bad either even if, to be honest, uv mapping in sketchup is such a mess for me haha i’ll keep it in mind if I have a project with only a few videos though !

Thank you for your input

@jan I’m bumping into this issue as well. I’m at 20 videos and once the scene starts that gradually start loading, and once they load they start playing on mute.

Based on the extensions I set for these, they are all set to no autoplay, not muted, and not looping.

I might need to explore having thumbnails on these textures and using some Javascript to load the video, but this seems quite a bit of work considering the option to handle video textures is already integrated to the editor.

Any thoughts on what might be causing this issue.

1 Like

This sounds like a bug, could you send us a link to the scene?

1 Like