How much memory is required to implement the z-buffer algorithm for a 512 x…

2014

How much memory is required to implement the z-buffer algorithm for a 512 x 512 x 24 bit-plane image?

  1. A.

    768 KB

  2. B.

    1 MB

  3. C.

    1.5 MB

  4. D.

    2 MB

Attempted by 14 students.

Show answer & explanation

Correct answer: C

Concept: The Z-buffer (depth-buffer) algorithm keeps TWO arrays in memory per pixel, not one: a depth buffer that stores a z-value at each pixel to decide which surface is nearest the viewer, and a frame buffer that stores the resulting colour/intensity that actually gets displayed. Implementing the algorithm costs the memory for BOTH arrays together, each sized width x height x bits-per-pixel.

Working:

  1. Total pixels in the image = 512 x 512 = 262,144.

  2. Each array stores 24 bits per pixel (the specified bit-plane depth), so one array needs 262,144 x 24 = 6,291,456 bits = 786,432 bytes = 768 KB.

  3. The algorithm keeps BOTH the depth buffer and the frame buffer in memory at once, so total memory = 2 x 786,432 bytes = 1,572,864 bytes.

  4. Converting to KB: 1,572,864 / 1024 = 1,536 KB.

  5. Converting to MB: 1,536 / 1024 = 1.5 MB.

Cross-check: Working directly in bits confirms this: 2 x 512 x 512 x 24 = 12,582,912 bits; 12,582,912 / 8 = 1,572,864 bytes; 1,572,864 / 1,048,576 = 1.5 MB - the same total.

So 1.5 MB of memory is required.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro