Coding Train Live 177: 2D Ray Casting and Ray Marching

preview_player
Показать описание
Today we will explore 2D Ray Casting and Ray Marching

Timestamps:
0:00 Live Stream Starts
5:52 Introduction
12:31 Community Contributions
23:35 Setting Up
25:48 Code! Ray Casting Coding Challenge
2:50:26 Small Break
2:55:40 Returning From Break
3:01:50 Code! Ray Marching
4:04:14 Conclusions and Goodbyes

Рекомендации по теме
Комментарии
Автор

If you think I'm going to sit here and watch a 4 hour hour video I have something to tell you...






You're right. Thanks.

thebirdhasbeencharged
Автор

Just one more video before I go to bed...

yourteacher
Автор

I tuned into the live stream when it started, then got busy with work all day. Just got home and the stream ended 5 minutes ago. Daniel does not have a setting for tired. <3 Thanks professor!

fazalali
Автор

Dude, you and your channel are another reasons to be happy.

bwatspro
Автор

I love the way that he was really patient with all people's work, a good trait of the great mentor

UPD
Автор

Hey, about the wolfenstein-like "3d view" of your raycasting experiment: Your walls appear curved because the rays in your field of vision are separated by steps of equal degree angles. That way you get a sort of "fish eye lens" type of thing. If you want to fix that, you need to do it like this:



The Particle (player) is in a certain position, looking in a certain direction. A little bit in front of the player, imagine a short line segment perpendicular to the viewing direction. The player is looking straight at the centre of this line segment. Consider this line segment as your virtual screen, or "scene". You loop over points on the line segment with equal steps, and you cast rays from the player to these points. So the points on the virtual screen are steps of equal distance, instead of the rays being cast with steps of equal angle. (this line segment is actually your "near plane" in 2D, if you're familiar with that term)

For short line segments (small field of vision) this may seem like a very subtle difference from the top-down (left) view, but in the 3d (right) view it is noticeable because the lines of straight walls aren't curved anymore.

Oh there is one more thing you need to fix: Currently you're mapping the height of a vertical strip to the distance reversed like height = (max_dist - distance)/something, but to get a proper perspective view the height must be proportional to the reciprocal of the distance, so like: height = someconstant / distance.

metadaat
Автор

1:28:54 add ray gradient transparency according to inverse square law."physical quantity or intensity is inversely proportional to the square of the distance from the source of that physical quantity"

ArtyomGalstyan
Автор

Coding Challenge: Cellular Automata on a "torus" shape or a sphere. You get the idea :)

DroidTsuenik
Автор

Ive been waiting years for this.... but totally worth it

lonec
Автор

Good God Your Energy is Awesome ! 4 Hrs at a stretch !

pullingrabbitsouttaahat
Автор

Thanks for talking about all this. For a lot of years, it's been hard to get good information.

DogwafflDan
Автор

Frame 25:55 Slippy floor dancing ... Wonderful :)

skippythemagnificent
Автор

At around 2:30:00 when you were working on the perspective thing, I think you needed to do

Height = map(1/scene[i], 1, 1/sceneW, sceneH, 0)

That way you're mapping the inverse of the distance, which goes between 1 and 1/sceneW, to between 0 and sceneH.

you also might need to multiply it by some scaling factor if its not quite right. But that's how you would do a map for an inverse relationship. And it would be a similar thing for the inverse square for distance, you would just do

Brightness = map(1/(scene[i]**2), 1, 1/(sceneW**2), 255, 0)

CalculusPhysics
Автор

I love your videos! You explain the most complex topics like you were explaining them to Michael Scott from the office😂❤️

anonymoussloth
Автор

He STARTED typing at 35:05 (in the non-stream but stream part)

codeforest
Автор

Two lines intersection is simply solution for 2 simultaneuous equations for lines

mabadi
Автор

Something odd starts happening at about 3:40:30 when someone mentions "clicking", then it goes into slideshow mode from 3:41:00 to 3:42:00 when the chat notifies you: I think you say it's not recording to disk :-(

PhilBoswell
Автор

Starts at 29:00 because we need his giggles

TharxGamma
Автор

36:33 while you were typing the text editor was telling you wich value was what(x1, y1...etc)...Where do you gett this addon from and what is its name?

heroiuraresjustinian
Автор

Could you please do TETRIS? I tried it in Processing but failed.

kernelpanic
welcome to shbcf.ru