CarlBateman Posted December 14, 2014 Share Posted December 14, 2014 I have a scene and would like to avoid a blank screen for the second or so it takes to build.I've tried putting scene.render() at various stages in the code but the scene still doesn't render until it's complete.Is there a way to force a render? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 14, 2014 Share Posted December 14, 2014 Hello Carl! You can use BABYLON.SceneLoader.ForceFullSceneLoadingForIncremental = true Quote Link to comment Share on other sites More sharing options...
CarlBateman Posted December 14, 2014 Author Share Posted December 14, 2014 Thanks but that doesn't seem to work. I'm building the scene in code, NOT loading it from file (sorry, if I didn't make that clear). I'd like something like the pseudo code below:makeFloor();makeSnowman();render.scene();for(i = 0; i < 100; i++) { makeChrismasTree(); render.scene();}(Scene at http://webglworkshop.com/demos/christmas/babylon.christmas.2014.html if that helps). Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 14, 2014 Share Posted December 14, 2014 Hi Carl, welcome to the forum, and may I say, what a nice scene! I'm Wingnut, hi, and I like to get involved where I don't belong... like getting into other people's business, and yapping when I'm not qualified to do so. This is no exception. http://playground.babylonjs.com/#UT7U2 I used poor coding to cause the ground, lights, camera, and SOME of the snowman... to render right away. Then a bit later, using more bad code in the scene.executeWhenReady function, the new buildLandscape() function executes. This solution is far from perfect, and I screwed-up all your indenting, but now we have SOMETHING for the user to look-at while your cool pine trees render. I had to remove your big particles texture and use something smaller, because the playground refused to save the demo scene. It thought maybe it was too large. Once I did the change, it saved fine. Anyway, this is a solution, but not a very good one. Maybe some smarter people than I... will play with the scene, and get some better results. I hope I didn't interrupt the flow of your thread. I am not a very good coder, so there is likely better ways to do this. Do you realize that you look like American music legend Steve Miller? Again, welcome, and good luck. Experts, help us out with this. Carl wants the scene to assemble right in front of the viewer's eyes, I suspect. Update: I now notice that the playground demo doesn't progressively-render... THE FIRST TIME, but only when hitting the RUN button again, and again. Shoot. Maybe this is no solve at all. Darn. Quote Link to comment Share on other sites More sharing options...
CarlBateman Posted December 14, 2014 Author Share Posted December 14, 2014 Hi Wingnut,thanks for the input, I considered your approach, but was checking to see whether there was a quick fix. I'll probably progressively add items to the scene from within the render loop, when I get a chance. Wow! That picture of me does look a lot like Steve Miller. Although he's slightly older than me. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 15, 2014 Share Posted December 15, 2014 As Wingnut mentioned, you can use executeWhenReady, but you can also check for scene.isReady() or event mesh.isReady() etc.. Quote Link to comment Share on other sites More sharing options...
CarlBateman Posted December 23, 2014 Author Share Posted December 23, 2014 I changed the code to add a tree once each time through the render loop. It works but is is a bit unresponsive until all the trees are added. Next, I'm thinking of trying web workers, cloning or instancing. Thanks for the suggestions, I'll look into them when I get chance... sadly my family demand my attention over Christmas... how inconsiderate . GameMonetize and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
joshcamas Posted December 26, 2014 Share Posted December 26, 2014 One interesting possibility would be to build the meshes, but make then invisible. then when all of them have loaded, make them visible. Quote Link to comment Share on other sites More sharing options...
CarlBateman Posted December 31, 2014 Author Share Posted December 31, 2014 Hi joshcamas,thanks for the suggestion but that doesn't address the problem, all the geometry would be generated before display, so there would still be a delay before the user sees anything. Quote Link to comment Share on other sites More sharing options...
reddozen Posted January 1, 2015 Share Posted January 1, 2015 How hard would it be to copy a loaded model from one canvas to another... say through an iframe? What if you used an iframe to basically load the model in the background without disturbing your current game loop? Once it's ready to render on the iframe, you just push all the models details back to parent since the iframe already downloaded the model to your index etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.