Skip to content

Raycasting

sarahmss edited this page Jul 3, 2022 · 7 revisions

Raycasting

Raycasting is a rendering technique to create a 3D perspective in a 2D map.

Basic Idea:

  • Map is a 2D square grid
  • Either grid can be 0: no wall or 1: Wall
  • For every pixel in screen, send out a ray that starts at the players's position and depend on both:
    1. Player's looking direction
    2. x-coordinate of the screen

image

Attributes

  1. Player's height
  2. Player's field of vision (FOV)
    • determines how wide the player sees the world in front of him/her.
  3. Player's position
    • To put the player inside the world, we need to define the player's x and y coordinates.
  4. Projection plane's dimension
  5. Relationship between player and project plane

Useful links

Raycasting.pdf

Clone this wiki locally