2D Game Development 2D Rendering and Graphics 2 — Questions and Answers
Question 1: What is a 'camera viewport' in 2D game rendering?
- The rectangular region of the world that the camera displays on screen (Correct answer)
- The physical screen resolution
- The camera's movement speed
- A post-processing region applied to part of the screen
Correct answer: The rectangular region of the world that the camera displays on screen
The camera viewport defines which area of the game world (in world units) is captured and mapped onto the screen rectangle for display.
Question 2: What is 'pixel-perfect rendering' in 2D games?
- Ensuring sprites are rendered at 1:1 pixel correspondence to avoid blurring (Correct answer)
- Rendering at the maximum display resolution
- Using pixel art exclusively in the game
- Applying anti-aliasing to all sprites
Correct answer: Ensuring sprites are rendered at 1:1 pixel correspondence to avoid blurring
Pixel-perfect rendering aligns sprites to whole pixel boundaries so art is not blurred by sub-pixel positioning, essential for preserving pixel art aesthetics.
Question 3: What is a 'render texture' used for in 2D games?
- Rendering a scene to an off-screen texture for use as a game object or post-processing input (Correct answer)
- Saving a screenshot automatically
- Baking lighting into a texture atlas
- Streaming high-resolution textures from disk
Correct answer: Rendering a scene to an off-screen texture for use as a game object or post-processing input
A render texture captures scene output to a texture in GPU memory, enabling effects like mini-maps, portals, security camera feeds, and full-screen post-processing.
Question 4: What is 'alpha blending' in 2D sprite rendering?
- Compositing a semi-transparent sprite over the background using its alpha channel (Correct answer)
- Fading sprites in and out over time
- Removing the background color from a sprite image
- Blending two animations together
Correct answer: Compositing a semi-transparent sprite over the background using its alpha channel
Alpha blending uses the sprite's alpha (transparency) channel to composite it onto the scene, supporting full transparency, partial transparency, and shadows.
Question 5: What is a 'normal map' used for in 2D games?
- Encoding surface orientation per-pixel to simulate 3D lighting on flat sprites (Correct answer)
- Defining walkable areas for AI
- Storing sprite animation data
- Providing a fallback low-resolution texture
Correct answer: Encoding surface orientation per-pixel to simulate 3D lighting on flat sprites
A normal map encodes fake surface normals that allow a 2D sprite to be lit with directional lights, creating the illusion of depth and surface detail.
Question 6: What is a 'color palette swap' shader technique in 2D games?
- Replacing specific colors in a sprite's palette at runtime to recolor characters without extra art (Correct answer)
- Switching between day and night color themes
- Applying color correction post-processing
- Selecting sprites from a color-coded atlas
Correct answer: Replacing specific colors in a sprite's palette at runtime to recolor characters without extra art
Palette swapping maps a sprite's original colors to a replacement set via a lookup texture, allowing one character sprite to render in multiple color variations cheaply.
What is a 'camera viewport' in 2D game rendering?