r/processing • • Nov 21 '19

Basic 2D Raycaster

Post image
200 Upvotes

9 comments sorted by

15

u/[deleted] Nov 21 '19

Source for those that asked: https://github.com/fiskurgit/ProcKtTemplate/blob/master/src/prockt/sketches/Sketch026.kt

It uses an old bouncing ball sketch for the angle/collision logic, using that I adapted it for (pseudo) light rays. Every time there's a collision the alpha is reduced, once the alpha hits zero the ray is removed from the stack. The speed dictates how far the ray travels each frame (lower speed on the right images, higher speed (left images) creates a nice diffraction effect). The code isn't as clean as I'd like but it's a starting point.

1

u/daal-jeem Nov 21 '19

Amazing! Think you could share source code?

2

u/[deleted] Nov 21 '19

np, see above/below

1

u/collapsus_linguae Nov 21 '19

Very cool! Source code if you feel like sharing would be great, I wanna play with this :-)

1

u/[deleted] Nov 21 '19

np, see above/below

1

u/dector9 Nov 21 '19

Amazing! Love this /r/sizz feeling.

1

u/AskMeForLinks Nov 21 '19

Wow, I love the effect this has. Nice work.

1

u/FuriousWK Nov 26 '19

so beautiful. amazing work