V!nc3r Posted June 23, 2016 Share Posted June 23, 2016 Hi all ! My scene is an apartment, and i want one cubemap for each room. I could generate it with precalculated render engine (vray, cycles, etc) but it force to reset & redo all materials of the scene, just for 6 texture generation... So i think it's easier to generate cubemap once during application launch. I suppose i just have to create one probe per room, on their center, with their refresh rate set to once ; plus its allow to regenerate on demand if the user make change on material settings (change wood floor to tiles for example). Here are my questions : how can i easily push all the scene during the generation, in each probes ? it is possible to push meshes which already use the probe on their reflection texture (is this will generate conflict) ? Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 23, 2016 Share Posted June 23, 2016 Hey! 1. After loading the scene, just run it in the onload handler 2. This will not be a problem Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted June 24, 2016 Share Posted June 24, 2016 Hi V!nc3r, can you please share your code so that i can refer the code, as i am also working on similar kind of project .where i need shadows for more than 4 lights, 2 mirror's and more than 10 meshes which need reflection probe . when i assigning all these, the scene is getting very slow. please share your thoughts ,how you doing things to improve scene performance. could you please explain me about 1. After loading the scene, just run it in the onload handler . Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted June 24, 2016 Author Share Posted June 24, 2016 @Deltakosh, i saw in the doc that we can assign meshes to probe like this : probe.renderList.push(myMesh); probe.renderList.push(myOtherMesh); probe.renderList.push(...); So i wrote a little code : pushMeshesToProbe(myProbe,["myMesh","myOtherMesh","..."], scene); function pushMeshesToProbe(probe, meshesList, scene) { for(var i = 0; i < meshesList.length; i++) { if(scene.getMeshByName(meshesList[i])){ probe.renderList.push(scene.getMeshByName(meshesList[i])); } } return null; } But in this case i still have to write name of each meshes for the meshesList array. Is their a magic function which say "hey, you see all these meshes ? select theim !" @Vijay Kumar no pb, but be patient 'cause i'm not a dev, so i wrote some not-optimized pieces of code. Have you already set a refreshrate ? Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted June 24, 2016 Share Posted June 24, 2016 for(var i = 0; i < scene.meshes.length; i++) { if(scene.meshes.parent.name.includes("meshparent")){ probe.renderList.push(scene.getMeshByName(scene.meshes); } } like this i am filtering the meshes from the scene, making all the necessary meshes as child to a parent, so that i can includes only these meshes in reflection probe. previously i didn't used any refreshrate, but now i am using probe.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE; now the scene performance is very good. i am very much worried about shadows when i use shadowgenerator for than 4 lights the scene is damn slow. for example: in hall atleast we should have 10 point light and shadows and when we apply shadows for all of them it is very slow. do you have any suggestion to overcome this issue. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 24, 2016 Share Posted June 24, 2016 Do you really need 10 dynamic lights??? And by the way you can also set the refreshRate of your shadows to Once Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted June 24, 2016 Share Posted June 24, 2016 Thanks Deltakosh. i have two questions : how to keep refresh rate of shadow to once because the content is static. how to keep refresh rate of mirror to once because the content is static. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 25, 2016 Share Posted June 25, 2016 1. Easy: shadowGenerator.getShadowMap().refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE; 2. Impossible: the mirror rendering depends on the position of the viewer 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.