Timeline for Understanding the rendering of the raycasting on flat screen
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 12, 2023 at 12:40 | history | edited | DMGregory♦ | CC BY-SA 4.0 |
typo
|
Apr 2, 2019 at 17:51 | vote | accept | Num Lock | ||
Apr 2, 2019 at 17:08 | vote | accept | Num Lock | ||
Apr 2, 2019 at 17:08 | |||||
Apr 2, 2019 at 11:09 | comment | added | DMGregory♦ | The example above demonstrates that if you use this method, you will get straight walls, no additional correction is needed to the heights beyond what's shown above. I still don't have a minimal complete verifiable example of the problem you observe when implementing the method I've shown here, so without that I can't help you diagnose what's wrong. | |
Apr 2, 2019 at 10:59 | comment | added | Num Lock | I understand and I thank you for that! Do you think there is a way to correct the difference of heights from rays near the perpendicular ray and the rays far to the perpendicular ray? Cause I have no straight walls as u shown in your example when look from side. | |
Apr 2, 2019 at 2:42 | comment | added | DMGregory♦ | @NumLock To double-check this, I built a test in Unity using the formulas I've described. No unnaturally curved walls in the result - it lines up with the rasterized reference render as expected. So, I think there must be a bug in how you've implemented this. Can you show us the code you use to choose the ray directions after trying to implement this answer? | |
Apr 2, 2019 at 2:39 | history | edited | DMGregory♦ | CC BY-SA 4.0 |
Adding demonstration
|
Mar 31, 2019 at 19:25 | comment | added | DMGregory♦ | Because half the field of view has to go on the left, and half on the right. So (i * 2.0 / screen width) gives us a value ranging from -1 to 1, multiplied by halfWidth gives us that half field of view on the left, half on the right for one full field of view in-between. | |
Mar 31, 2019 at 19:19 | comment | added | Num Lock | Ty! For the explanation, why do u compute offset like that? | |
Mar 31, 2019 at 17:55 | history | answered | DMGregory♦ | CC BY-SA 4.0 |