-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View Frustum culling of children does not work #6834
Comments
I'm having a hard time to follow your issue description. Can you create a jsfiddle that reproduces the issue? |
Sorry I upated my original text and tried to make it a little bit more clear how our tests look like currently. we will provide the example as code in the next hours |
Ok here is the jsfiddle to reproduce the problem: http://jsfiddle.net/vao125wx/13 When we don't apply the image as an texture it does not crash ( http://jsfiddle.net/vao125wx/14/ ) so we assume it must be the graphics memory and not the normal device memory which causes the problem. Maybe freeing graphics memory on mobile phones is broken or different? on the desktop we didn't manage to crash it |
AFAIK To free memory you need to actually remove the object from the scene and dispose the meshes, textures or both. http://stackoverflow.com/questions/21851349/freeing-memory-in-three-js is a bit old but gives you the idea. |
To release the memory we do exactly what is posted in your stackoverflow link, the visible flag we dont use in the simplified example ( http://jsfiddle.net/vao125wx/13/ ) now, but it still crashes on the mobile devices, because the graphics memory is not freed for some reason |
I recall seeing an issue recently about memory not being freed, might be a bug in current version. It did work earlier. My flight is leaving now so can't check more - will search for that issue later unless others have provided info already. |
Removed errors/warnings from fiddle: http://jsfiddle.net/vao125wx/17/
|
Using the |
|
You need to dispose of textures manually because they can be used by multiple materials. |
Thanks, @gero3. Here is an equivalent way:
|
Uh nice, so only this line "mesh.material.map.dispose();" was missing, but I don't get why material.dispose() does not not trigger material.map.dispose() as well, why is that so? |
As @gero3 said, because the texture could be used in another material. |
But couldn't the material/texture figure this out itself? Something like a TextureManager which checks such references and releases memory automatically? |
What if you just want to create a new material with the same texture while disposing of the material?? |
Yes and no. I can easily imagine a use case were someone is changing materials but using the same texture and we're disposing and uploading the texture wastefully. |
Yep, same as @gero3 said. |
We should, however, add a note about this in |
If I run now the latest http://jsfiddle.net/vao125wx/25/ with renderer.info.memory.textures constantly staying at 1 on the Samsung S3 it works much longer (it makes it to 100-120 loaded textures but then still crashes) so there must be another object we do not release :/ Maybe its now not the graphics memory but the normal browser memory? |
Reference counting for textures could be a useful thing to consider? |
http://jsfiddle.net/vao125wx/27/ Convert http://jsfiddle.net/vao125wx/28/ Clear the Also, if you use Chrome, you can monitor the GPU memory usage in chrome://memory |
Good catch! |
Oh ok thanks for the tip with chrome://memory 👍 |
You can clear the cache in your |
You should be able to enable or disable the cache don't you think so @dubejf |
@gero3 Overwriting Also, maybe the cache should not be global and be per-loader instance instead, to limit growth to the lifetime of the loader. Previous discussion #5650 |
@simon-heinen How about changing the title and content of your original post so it is descriptive of the issue. |
This bit me as well. Could not for the life of me figure out where 40MB of Having the ability to enable or disable the cache would be nice (I just replaced the Perhaps the docs should describe in |
How about an argument to cache or not when loading? |
The global cache should be opt-in. mrdoob#6834
|
It seems to us that the frustum culling does not work for children of an object in the scene. Here is a simplified problem description:
Our testing devices are mobile devices (the fastest it crashes on an samsung s3 but the same problems seem to occur on desktop machines after the memory limits are reached)
JSFiddle to reproduce the problem: http://jsfiddle.net/vao125wx/13
The text was updated successfully, but these errors were encountered: