Hi! Is there a built-in way that a mesh using the StandardMaterial and PBRMaterial can be drawn for sure in the next frame? What I mean by that is e.g. a callback that would signal that everything is prepared on the GPU and once setting to visible it’s going to be drawn in the next frame. I’ve played around with setEnabled(), visibility and alpha but it seems that nothing is prepared as long as it’s not going to be displayed.
I’ve used a ShaderMaterial for now that is using its own alpha uniform together with onBeforeRenderObservable but I’d need some functionality from the StandardMaterial and PBRMaterial now and that’s why I need to have the same behavior there now.
What I’d like to achieve in the end is that I can remove one object and draw another one seamlessly in one frame. Hope someone can help me out here!
/**
* Determine if the current mesh is ready to be rendered
* @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)
* @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)
* @returns true if all associated assets are ready (material, textures, shaders)
*/
public isReady(completeCheck = false, forceInstanceSupport = false): boolean {
I am not sure if this will bring things down to one frame. I think forceCompilation on the mesh’s material helps before marking the mesh as ready to be added to scene. I suppose @JCPalmer approach waits for that to be done too!
this sounds good. That means one has to check every frame if the mesh is ready, there is no callback that does the same, right? Because onReady() doesn’t have the completeCheck option, which explains why it didn’t work for me.