V
V
vaselekk2021-05-30 21:46:02
3D
vaselekk, 2021-05-30 21:46:02

How does ray casting work on the example of a square?

I know the ray casting type from this example:
60b3dd35230a7697393907.gif
I was already able to figure out how such an example works, if the game screen is divided into strips, and in 2d space the player releases a ray, if he encounters an obstacle, then the area on the game screen is painted over. if it doesn’t hit, then it’s just not painted over, but the question is. how to make the game more difficult, can you explain how to make it possible to look at a square from different angles in space? well, that is, to have a square and with the help of ray casting it was possible to draw it at an angle, having risen along the (y) axis in the plane, look at the square from the top side, how to do this?
create a classic 3d and not a pseudo walker

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2021-10-15
@vaselekk

here is an example made just on ray tracing, it was all done within the framework of this question https://qna.habr.com/q/911259 . Code without comments, but I think you will understand
5fea7f268ea1d386247037.png

A
Alexander Pavlyuk, 2021-05-30
@pav5000

A good series of articles on Habré, which helps to understand how 3D graphics rendering works. https://habr.com/en/post/248153/
To understand how camera movement and rotation works, you need to read 3 parts of this article: "4. Necessary geometry: matrix festival"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question