Replies: 4 comments 4 replies
-
That repo came up in my github feed today - looks cool! I was thinking about it a little bit. I think it's easy enough to stop the render loop like in that thread. To have it on auto will need more than pointer events. Sometimes the camera is moving (maybe we can listen for that), but also there could be a mesh moved or rotated, but then I suppose we could put a Might be good to have as an enum to allow more options. I'm thinking 'always', 'never', 'minimum', 'alternate' or something. Maybe we don't need that many, but minimum would render on pointer down until pointer up (or left screen) and monitor cameras. Maybe 'alternate' could be used to only render some frames - like every other frame for low power devices. Anyway, it's an interesting idea and it caught my attention as well. |
Beta Was this translation helpful? Give feedback.
-
Sounds like a good starting point! I only looked over three-elements code shortly, but I had the feeling that it listens to all possible events and then fires the render, something like an event pipeline close to the render loop. Maybe the enum can be some kind of profiles, too. Similar to the Scene Optimization features of babylon with preconfiguration or you do it on your own (https://doc.babylonjs.com/divingDeeper/scene/sceneOptimizer). |
Beta Was this translation helpful? Give feedback.
-
Hey,
|
Beta Was this translation helpful? Give feedback.
-
This thread has nice discussion and playgrounds on scene optimization: I have created a hook. However, it is not well tested yet and it is missing trigger of scene.render() on i.e. loading of assets. So you might only see your assets after moving the camera.
|
Beta Was this translation helpful? Give feedback.
-
Hi,
in my latest pull request I have extended the snippet material example with code to freeze a node material for better performance and unfreeze it as soon as its values are being updated. This might be extendable to other materials. But I was rather wondering, if we could adapt this for other purposes such as i.e. rendering. Recently I saw this webgl-library, which is pausing rendering if nothing is happening: https://github.com/hmans/three-elements
Since we should know about the states of our components, we could only trigger rendering, if we interact with the scene. Actually doing this for camera movement might be manageable, as soon as the camera moves, the render loop continues. However, if we have elements that change color i.e. on mouse over and the camera is not moving, the color might not get updated. Therefore, it would require maybe a hook that would fire a rerender of the scene. Or if all events within babylon are observable, we could trigger rerender. However, I guess it is not so easy.
Eitherway, I could imagine adding a pause parameter to the Scene component might be a good addition? https://forum.babylonjs.com/t/solved-possibility-to-pause-rendering-without-removing-render-loops/5921/3
Beta Was this translation helpful? Give feedback.
All reactions