Back to the Shapespark home page

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

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.

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