I’m trying to increase the resolution of some Billboard GUIs that I have placed on a 3D diagram I’m making.
In order to achieve this, I have tried boosting the ‘AdvancedDynamicTexture’ resolution by sizing up my rectangles and textBlocks within, then scaling down the adt. Doing this shows a significant amount(+4GB) of GPU memory consumption for having ~20 billboard GUI’s placed. The only difference there is whether I turn scaling on or off.
Not sure if I’m approaching this from an odd direction, but the scaling shouldn’t make my GPU memory consumption jump like that.
Watch the ‘GPU Process’
You can see it spike when you toggle scaling. with / without the scaling enabled changes the GPU memory usage by ~500MB in my example.
The thing is you have 253Mb for the texture + what the underlying canvas 2d needs so another 253Mb + extra copies when uploading to gl as the memory is not shared and probably some mip mapping adding another 30%. So a GPUMemory of about 500Mb + the equivalent internal one retained by Chrome.
I am actually trying to work with both the Edge and Chrome team to see if there would be a way to share the memory directly in case the canvas is only used by GL but it will take time.
You’re saying that this is because when the texture is in memory and scaled, the system keeps multiple copies raw in the GPU memory in addition to the memory of the object in the JS Heap?
I figure that scaling would tell Babylon to raster the image at the scaled down resolution, then pass it over to the GL. That’s why I’m not quite following the high GL memory usage here.
Yes gui works with a 2d canvas to draw shape and texts, so scaling means scaling the source canvas and the corresponding webgl texture as this is not shared memory.
I figure that scaling would tell Babylon to raster the image at the scaled down resolution, then pass it over to the GL. That’s why I’m not quite following the high GL memory usage here.
I am not sure what you mean by scaled down here as you put a parameter to actually increase its size by ten times what it would normally be
That’s what I would normally think – why is it shrinking the texture? Is it because it’s increasing the source resolution of the ADT and the ADT forces it to shrink to fit in the texture?
What I am experiencing is that if I pass ‘2’ into scale, it actually shrinks the size of the GUI component.
Is this because scale actually doubles the resolution, and the GUI shrinks it to fit within the bounds of the GUI?
It shrinks because the texture is doubled but your mesh/gui object is still the same size on screen (I assume). If you generate some texts in your texture, you should generate it with twice the font size if you want it to be the same size when you double the texture size.
Yeah, that’s what I understood after going through this thread.
I think there should be some form of warning if someone creates massive textures in an ADT. If it has the capacity to very quickly consume