White box when changing materials?

So currently I’m animating using bezier paths and I want to change the material on a PNG (plane) during the animation. I’ve added the materials property to the timeline, and when the material swaps during playback, a white rectangle briefly appears before swapping materials. I have a feeling theres a single frame during playback where the plane has no materials set, causing the white rectangle to briefly appear.

Is there a way to avoid this?

Hi @abiro,

Sounds like it might be one better suited to being setup in a script. I think the white plane is just the frame in which the material is changing. If it was a state I’d suggest changing the transition speed to instant but I don’t think this is possible along a timeline.

Feel free to send over a minimum version the project and I’ll take a look!

George

1 Like

If you set a material property to a media file reference directly, then Studio will construct a Material / Texture pair under the hood, set the texture’s source to the file, and queue a message to load the texture. You’ll see the object will get a “notready” event and then a “ready” event in the following frame when the texture data is uploaded.

When the hierarchy is initially loaded, the experience isn’t shown until “ready” has propagated all the way to the root node of the scene - this means we only need to load textures for Media Files that are actually in use in the hierarchy, so it’s a form of lazy-loading.

To swap instantly you can add ImageTexture nodes for the textures you want to swap between, and use them in your state / timeline changes. Those ImageTexture nodes will be loaded up-front, and as their source isn’t be reset during runtime they should just be instantly “ready” for use, and rendered in the same frame you set them.

HTH!

2 Likes

So I finally got around to trying this method out, and it worked beautifully. Thank you!