Jump to content

Cubemap generation at launch


V!nc3r
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...