gamefan Posted May 25, 2017 Share Posted May 25, 2017 Hi, I want to offer user to disable reflections in my application so that there is gain in fps if he/she wishes to. I set ReflectionTextureEnabled in standardMaterial to false, the reflection is disabled but there is no performance gain. Removing the reflection texture from the mesh's material does increase the fps count. But I don't want to remove the reflection texture completely as user can toggle this back on again. Any strategies on how to do this? http://www.babylonjs-playground.com/#DHPSEM#1 Quote Link to comment Share on other sites More sharing options...
adam Posted May 25, 2017 Share Posted May 25, 2017 Try removing the meshes from the renderList. Quote Link to comment Share on other sites More sharing options...
gamefan Posted May 25, 2017 Author Share Posted May 25, 2017 It can be done but I will have to index the meshes in the render list so that they can be added back again once reflections is switched on. I was looking for a simpler solution. Is there a property that will completely disable reflections somewhere deep down in the babylon render loop? Quote Link to comment Share on other sites More sharing options...
adam Posted May 25, 2017 Share Posted May 25, 2017 21 hours ago, gamefan said: Is there a property that will completely disable reflections somewhere deep down in the babylon render loop? I would think that StandardMaterial.ReflectionTextureEnabled would be the answer. This appears to be a bug. edit: This fix increases the fps (maybe not completely): http://www.babylonjs-playground.com/#DHPSEM#11 If you try setting StandardMaterial.ReflectionTextureEnabled to false after the scene is loaded you get a broken reflection: http://www.babylonjs-playground.com/#DHPSEM#10 gamefan 1 Quote Link to comment Share on other sites More sharing options...
gamefan Posted May 26, 2017 Author Share Posted May 26, 2017 13 hours ago, adam said: If try setting StandardMaterial.ReflectionTextureEnabled to false after the scene is loaded you get a broken reflection: Yeah, noticed this. Once set ReflectionTextureEnabled to false it has to be set to true to enable reflection again. That property remains unchanged in the browser session of pg. #11 increases the fps, but will have to do this to all materials. Can I someway override a StandardMaterial function without editing the babylonjs file. Thanks Quote Link to comment Share on other sites More sharing options...
Sebavan Posted May 26, 2017 Share Posted May 26, 2017 Adams fix has just been deployed to the playground, your first sample now works as expected it drop the number of commands from 689 to 341 and 203 draw calls to 103. You can verify it with http://spector.babylonjs.com Quote Link to comment Share on other sites More sharing options...
adam Posted May 26, 2017 Share Posted May 26, 2017 I submitted another PR this morning that should allow you to switch reflections on and off correctly after the scene is loaded. Quote Link to comment Share on other sites More sharing options...
adam Posted May 27, 2017 Share Posted May 27, 2017 This is now working. http://www.babylonjs-playground.com/index.html#DHPSEM#20 GameMonetize and Sebavan 2 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.