pichou Posted September 29, 2017 Share Posted September 29, 2017 I try to optimize one of my scene and to do so I adapt my code to use createInstance instead of clone. But as a result my scene (fps) is slower with createInstance than with clone when it should be the opposite right? To sum up my code, here is the steps I follow : - import mesh - clone mesh and add material (because one mesh can have 2 different materials) - create instance mesh - add in the scene At the third step, I get a better fps when I use clone instead of createinstance. Do you have an idea? Thanks! Quote Link to comment Share on other sites More sharing options...
pichou Posted September 30, 2017 Author Share Posted September 30, 2017 And to be more specific, my meshes use multiMaterial with two subMaterials. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted September 30, 2017 Share Posted September 30, 2017 Would it be possible to create a repro in the Playground ? Quote Link to comment Share on other sites More sharing options...
Raggar Posted September 30, 2017 Share Posted September 30, 2017 Instances are much better performance-wise, so you must have a bug somewhere. Look at these 2 examples: https://www.babylonjs-playground.com/#2I6IG4#4 This example uses animated clones, and with 100 clones I get between 50 and 60FPS. https://www.babylonjs-playground.com/#2I6IG4#5 This example uses instances of the same animated model, and with 600 instances, I get mostly a solid 60FPS, with some drops to the heigh 40's, mid 50's. Quote Link to comment Share on other sites More sharing options...
pichou Posted September 30, 2017 Author Share Posted September 30, 2017 OK, It's weird because I don't have the same result with your playgrounds. I only get around 15 fps with your useinstance example. I use chrome and my computer is an asus Zenbook 3 with a core I7. Another thing with my project is that after a few seconds it freeze my tab, I can't refresh or acces to the console when the scene is still rendering correctly (with a bad fps though). So as you say I must have a bug but can't figure out what it is. I only use around twenty shape in my scene which have diffuse, specular and bump texture and half of them are instance/clone of an other. What do you advise me to test? Quote Link to comment Share on other sites More sharing options...
Raggar Posted September 30, 2017 Share Posted September 30, 2017 The best thing to do would be recreating your example in a playground. That way others can help pinpoint the issue. 15FPS? What about the clone example? Try lowering the number of monsters to something like 50. Quote Link to comment Share on other sites More sharing options...
pichou Posted September 30, 2017 Author Share Posted September 30, 2017 I get 50-60 fps with 100 clone mesh and 60 fps with 100 instance mesh. But 15 fps with 600 instance mesh. ok I will work on a playground! Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 30, 2017 Share Posted September 30, 2017 Just my 2 cents. Using an i5, & a GTX 1050, both ways get me 60 (with intermittant drops when moving camera). If you have an i7, then this is probably related to your GPU. Turn on debug on one of those playgrounds. Go to stats, see if instances are implemented in hardware. See Below. If not, your question is answered. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 30, 2017 Share Posted September 30, 2017 Also, I did a check of specs of your ZenBook. It has no dedicated GPU, but rather an Integrated Intel HD Graphics 620. Your options become quite limiting, and sounds like your project is just too big for hardware, judging by the freezing. If you plan on publishing this for others, you could just suffer through, and test occasionally on a machine with an actual GPU. Most develop on fast GPU machines, and have a mobile or under powered machine as a tester, but you have what you have. Quote Link to comment Share on other sites More sharing options...
pichou Posted September 30, 2017 Author Share Posted September 30, 2017 Oh I didn't know about the debug console of the playground, very useful. All the extension are put to yes. OK so you are saying my machine is the problem? I have always notice that it is not very performant with games but not that much! Then I will test my project on friends computer to confirm that. I guess I will have to find another computer so that I can develop with correct rendering. What are the other important specifications to look out except the GPU? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 30, 2017 Share Posted September 30, 2017 Yes, likely. In general, it is always good to have more than one device with different performance capabilities though. Switching up occasionally, helps spot issues earlier in dev cycle. As far as an ideal graphics dev machine. An i5 is a good choice, possibly with a higher mhz. Anything more will create blindspots where you will not notice that you are very CPU bound till later than you would like. Plus you can save here. Having an M2 socket for a solid state boot drive is a good sign you have a recent motherboard. I rebuilt my desktop in the last year. The motherboard has an M2. I never got the memory drive, as sleep is a good substitute to powering off. An old motherboard, when it is a new machine is not a good sign. Having 2 sets of sims for memory is good. Also ensure that both are not being used, so that you can expand memory without throwing away the existing. 2 8gb sims, and I can have an Eclipse IDEwith multiple projects open, multiple browsers with scenes, & Blender all open, all in memory with ease. You cannot mix memory sizes, so bigger is better. Power supply is starting to become a non-issue, as GPU's are requiring less & less power. The GTX 1050 is not the fastest, but is a short card (2 slots) that needs no supplemental power connection. If you also plan on playing commercial games as well, you might wish more though. Quote Link to comment Share on other sites More sharing options...
pichou Posted October 2, 2017 Author Share Posted October 2, 2017 Ok I figured out what was my problem! With one mesh I was cloning a lot of other mesh as "tools" (line, sphere, disc...) which I use for attacks and other animations. I replace those cloning by instance and this is a lot better. I have between 35 and 45 fps even on my "shitty" computer! Sorry for the false alert but I am glad I have learn new stuff on babylonjs and performance issues thanks to you @JCPalmer and @Raggar. RaananW 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 2, 2017 Share Posted October 2, 2017 Shitty computers are the best! It means the game will run on any other computer! Glad the problem was solved, thanks for sharing the explanation. Quote Link to comment Share on other sites More sharing options...
pichou Posted October 2, 2017 Author Share Posted October 2, 2017 @RaananW, this is exactly what I tell myself. It push me to look for optimization as when the scene is too slow, I will be the first to see it and not the players! 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.