Jump to content

Octree - Hiding Meshs


Recommended Posts

This is very similar to the last issue where the top of the statue was missing. In this case, parts of the scene aren't visible unless the view angle is correct. I'm not sure I can reproduce this with a smaller scene. A link to examples is below.


Without Octree



With Octree (press the octree button when it's done loading.

After the scene loads (almost 250000 verts), press the Octree button to turn them on. You may have to click it a few times.


Link to comment
Share on other sites

I had a similar problem that I solved with:

for (var i = 0; i < mesh.getChildren().length; i++) {    octree.dynamicContent.push(mesh.getChildren()[i]);    mesh.getChildren()[i].useOctreeForCollisions = true;}

You must also set MaxZ of the camera to see.

Link to comment
Share on other sites

I'll look into setting up a kind of "mouseover" to show object name feature. Would it help if i used the debug on babylon 13 instead?


Is there anything specifically that would help you look at larger scenes (this town represents 1/5 of the total map that this will be)? I only see my scenes getting larger and in some cases it may only be possible to bring out the bug on that scale. I want to make it as easy for you to look at as possible, and I'll work out any tools I need to.



Could this have something o do with instances and octrees maybe?

Link to comment
Share on other sites

Thanks. I'm not sure what those materials are to be honest... they don't have extensions on them... I think that they're coming across from my Unreal engine exporter, but there's nothing named that in ANY of the texture packages in me unreal files... very strange. I'll probably just end of deleting them from the meshes, and write it off as a glitch.


The scene loads VERY slow without the compiled version of babylon. This is what DK needed to debug the scene though, so I will do whatever he needs to make it easier for him to look at.

Link to comment
Share on other sites

Yes I understand. but when you say the scene is very long a load, this mean how long. because at the end of 4 minute, I told myself that the scene won't it load. This could this happen if other person tests your scene.

Link to comment
Share on other sites

You are correct, this scene is not loading currently. For whatever reason, when I enable the octrees using this method, nothing loads. If I were to disable octrees, it would load after 2~3 minutes.


I need to know why octrees are failing now. I have a try/catch in there to keep the javascript from crashing, so it's not that. The try/catch was my only solution for the problem with async loading of the models through import mesh causing a race condition and the octree call beating the file loads.

Link to comment
Share on other sites

Sooo... few questions.


So far I have around 1.5~1.6 million vertexes in my scene. Without octrees I'm running at about 20~30FPS. With them on it drops to 5~8FPS, and some of the meshes disappear as I've reported.


1) What would cause the the frame rate to drop so much if these are supposed to help speed up a scene by eliminating things that aren't visible etc?

- Should backfaceculling be enabled on the meshes? (Is it seeing through walls)

- Should mesh.useOctreeForRenderingSelection be included on all the meshes in the scene?


2) Could the meshes disappearing be because they're translated prior to being exported from 3DS Max, and babylon thinks that their center is somewhere else (assuming that it uses the center of the mesh for octree assignment)?

- What is used to determine what meshes are in what octrees, and how do those rules apply to visibility?

-- Example: A mesh is part of tree 1 and tree 2. If tree 1 says that it's visible, then tree 2 says it's not, if tree 2 is the last one to assign a visibility, then is it not visible?

Link to comment
Share on other sites



1/ the octree help selecting meshes. If you only have a few meshes then this is not a good idea to create an octree. If you have, let's say, more than 200 meshes then creating a simple octree can be ok.

backFaceCulling is only useful with transparent meshes

useOctreeForRenderingSelection is for meshes with a lot of submeshes


2/babylonjs compute a bounding box for every mesh. If an object is not moving then octree could be useful else you have to put your object in the dynamicMeshes of your octree

There is only one octree per scene (and one octree per mesh if you activate it)

Link to comment
Share on other sites

I guess for 2 I should have been more clear. I'm asking more how it knows which zone of the octree the mesh is in. None of my meshes are moving.


This might help figure out what's going on... the walls floating above are my invisible objects that all my visible scene meshes are instanced from. They shouldn't be visible at all.



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.

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.


  • Recently Browsing   0 members

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