Vram question(s)

This forum is currently in read-only mode.
  • Ok two questions.

    First off if I have a base image on a sprite that is power of two, will it still take up the same amount of vram if its re-sized bigger in the layout?

    Second is vram on a distort map.

    If you tick show fps, it will also show vram, but it looks like there's no change what so ever on a distort map, even with a large map (columns/ rows).

    So the question is, is this really not taking up much memory, or is that reading off?

  • First off if I have a base image on a sprite that is power of two, will it still take up the same amount of vram if its re-sized bigger in the layout?

    Yeah it will take the same amount of Vram if resized bigger... I made a simple black texture. 128x128 and resized it to 99999x99999, and each time it took up 0.06mb of vram.

  • There's more involved, but to keep it simple and imaginable:

    Think of the screen as a canvas. This canvas is stored in the vram and doesn't change (unless you switch resolution, where everything is rearranged, but let's forget about it now). Now everything is drawn to that one canvas.

    Let's say, that canvas is 1280x720. Whatever you draw now is clipped to that extend. A 20000x20000 image will only take up 1280x720. It's the same as using a paint program. You set up a canvas and draw to it, and nothing will be drawn outside that canvas.

    BUT, the sources need to be placed in vram, too. So, if you place an image with 128x128, it will consume exactly the space needed for 128x128, no matter how large you draw it to the output canvas. The same applies if you draw it smaller. It will still consume the space for 128x128, because the source doesn't change at all.

    It's a bit different with vertex data. These are also stored in vram. But they don't use much space. Again to keep it simple, let's forget about finer details. There are 3 informations per vertex point (x, y, z) Even if they were of double precision, they would only need 24 bytes per point. A sprite with 10x10 vertex points would consume ~0.002 mb (with single precision it would be 0.001 mb). Of course there are overheads, but basically that's it. Calculating the points (distorting the source image while drawing to the output canvas) is a concern, as it takes more gp time than just drawing the source image.

    Of course, this is a simplified image of what is really going on, but this makes it easier to understand, I think.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That's a good summary, but the vertex stuff probably isn't worth worrying about. Vertices are actually only stored temporarily (they're re-sent every frame), not in permanent texture memory, so it works a bit differently. You only need to worry about textures.

  • ... and of course the oblivious. A re-sized (scaled up) image will be more blurry as you increase in size. So there is no free lunch.

    I have done this to get a slightly larger image with out taking the next vram hit.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)