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?
- A.
768 KB
- B.
1 MB
- C.
1.5 MB
- 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:
Total pixels in the image = 512 x 512 = 262,144.
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.
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.
Converting to KB: 1,572,864 / 1024 = 1,536 KB.
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.