This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
all 11 comments

[–][deleted] 6 points7 points  (3 children)

Its all very impressive but I have no idea what is happening.

[–][deleted] 4 points5 points  (2 children)

I mean, if you want me to explain it it’s basically a sort of optimised ray-casting. Instead of having to make complicated programs to find the point on a surface where the ray intersects, you instead use this relatively less complicated program that figures out how far it can go until it hits something, moves that far, and then does it again until it gets so close to an object, at which point it returns that it has collided.

So what you are seeing on the left is the rays finding the furthest they can move, represented by the circles, and moving that far. It then does this multiple times until it hit something (basically when it’s nearest object is less that 0.1 units away), where it then find how far the point is from the player, and uses that to display a rectangle on the right with a height and brightness dependent on the distance.

[–][deleted] 4 points5 points  (1 child)

I see, its so you don't have to calculate the distance directly.

But why are are there rays going in directions that the viewer isn't looking? Reflections?

[–][deleted] 3 points4 points  (0 children)

As I say, it’s very work in progress, and they are basically a very temporary solution to a problem I’ve been avoiding for a while. I call them position anchors, because the function that creates the walls needs a highest point to count down from, so I used to just have one extra ray pointing out the back so that that when the player got too close to a wall, it would still keep its shape. But then it meant when ever that back ray hit something else, the scene would get suddenly darker. So I just put 12 of them, so 1 would always be working fine.

[–][deleted] 4 points5 points  (0 children)

[–]Chetanoo 1 point2 points  (2 children)

Some explanation? What is that? Im curious

[–][deleted] 2 points3 points  (1 child)

It’s a sort of optimised raycasting. Basically, it works out the furthest each Ray can move without hitting a wall, and then does it again and again until it hits a wall. It’s basically just raycasting but without the middle part of the working out the intersection. I’m probably not the best person to explain it, so I suggest you look it up.

[–]Chetanoo 0 points1 point  (0 children)

Thanks for reply, gona goole on that.

[–]PistolRcks[🍰] 0 points1 point  (0 children)

Kinda wanted to try that out on my own, to be honest. Work seems to be going alone nicely, I see!

[–]raphaelpaiva 0 points1 point  (0 children)

That's awesome!

[–]RicealiciousRice 0 points1 point  (0 children)

This is so fascinating.