wip readme presentation

This commit is contained in:
asus
2024-01-20 15:35:52 +01:00
parent 22ce374b58
commit f1ac1efaba
15 changed files with 34 additions and 1 deletions

View File

@@ -54,6 +54,39 @@ And change the map itself :
# raycasting
---
Raycasting is a technic that creates the illusion of 3D with very low computational power.
This technic has the hability to not show hidden area by design, which is a great simplification for rendering.
How it works :
1. first you determine the position and orientation of the viewer in a plan,
![](assets/raycast_step1.png)
2. then you cast a ray until it reaches a wall
![](assets/raycast_step2.png)
3. you can now trace the vertical line on the 3D view
![](assets/raycast_step3.png)
4. the height of the wall is inversely proportional to the length of the ray : the closer the wall, the heigher it is
![](assets/raycast_step4.png)
5. finally, if the rays scan the whole picture, you see the perspective appears
![](assets/raycast_steps.gif)
6. but you can also see that walls are rounded, like a fish eye effect. It's because rays change length while scanning the wall, so we must apply a correction to the angle
![](assets/raycast_steps_round.gif)
example of raycasting in action while construction of the project :
![example of raycasting during the construction of the project](assets/cube3d_raycasting.gif)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/raycast_step1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
assets/raycast_step2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
assets/raycast_step3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
assets/raycast_step4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
assets/raycast_steps.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@@ -34,7 +34,7 @@
/* size of a cell on the map */
# define CELL 100
// minimum time in milliseconds between two keypress
# define DEBOUNCE_TIME 500
# define DEBOUNCE_TIME 10
/*