Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF 3D video memory efficiency
    text
    copied!<p>Ill try to explain my situation as best as I can, sorry if it is not too clear...</p> <p>I have a Viewport3D that contains some large 3d rectangles that are like big crystals.</p> <p>When the user click on one of the crystals, I add a new material to the crystal in the spot the use clicked using an ImageBrush. I then iterate over a list of bitmaps (<code>List&lt;BitmapImage&gt;</code> collection) and update the ImageBrush each frame to create an animation on the 3D crystal.</p> <p>This works nice and I have up to 5 different effects playing on the crystals, but after profiling my application, I have discovered that due to mipmaps (I think) and the way 3d renders, my video memory jumps through the roof!!</p> <p>By my calculation, if I have a 75 frame animation, by 400x400 running at 4 bytes per pixel, and having ~5 different animations piled up, you can see how this can get large :)</p> <p>75 * 400 * 400 * 4 * 5 = ~250MB</p> <p>this is an issue, not only because of the size, but also, the BitmapImages stay in Video Memory until I make them null, which is very annoying and performance costly.</p> <p>My idea to fix this is to change from having <code>List&lt;BitmapImage&gt;</code> collection, to having a <code>List&lt;Byte[]&gt;</code> and rather than updating an ImageSource, I would like to try to use a <code>WriteableBitmap</code> that write the bytes to it.</p> <p>The issue is I have no idea how to read bytes from a PNG file, then create a <code>WriteableBitmap</code> and write the bytes to it over and over in an efficient manor.</p> <p>Can anyone please help me out?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload