QB64 Phoenix Edition
Fun with Ray Casting - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26)
+---- Forum: a740g (https://qb64phoenix.com/forum/forumdisplay.php?fid=56)
+---- Thread: Fun with Ray Casting (/showthread.php?tid=3372)

Pages: 1 2


RE: Fun with Ray Casting - a740g - 01-17-2025

(01-16-2025, 06:20 PM)MasterGy Wrote: Sorry, I don't want to trash your code Smile I just got carried away because I really like it and studied it a bit.
If you rewrite this in 'Renderframe', the landscape will darken proportionally to the distance and improve the 3d experience a bit. The bigger the ".001", the bigger the effect. At ".01" it's like walking at night with a flashlight.

Code: (Select All)
 
If heightOnScreen < hiddenY(i) Then
  Dim col As Long
  col = map(MAP_COLOR, mapPos.x, mapPos.y)
  Dim multi As Single
  multi = 1 - Abs(z) * .001
  Line (i, heightOnScreen)-(i, hiddenY(i)), _RGB32(_Red(col) * multi, _Green(col) * multi, _Blue(col) * multi)
  hiddenY(i) = heightOnScreen
End If

Thanks! Glad you like it.

No worries. That's a solid tip which I am going to shamelessly steal.  Big Grin