by Almar Joling (9 Submissions)
Category: Graphics
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(10 Votes)

Complete rebuild of my previous port of the C++ raytracer. This supports: Spheres, Triangles, Planes, Cylinders. Also supports shadows(!), reflections(!!), and multiple _colored_ light sources. Hence why it is so slow. You can now turn on/off options, so you can see everything nicely. Note that you MUST compile to get a bit decent framerate. With triangle support, it's in theory possible to load 3D models and raytrace them.
I might optimize the code later (it's become a bit messy), but it really depends on your votes.
Note that the rendered scene might look a bit chaotic. This is more because of the large "gaps" between every frame.
Note that Raytracers are known for their slowness. That's why there aren't (m)any real-time raytraced programs yet.
API DeclarationsPublic Declare Function SetDIBits Lib "gdi32" (ByVal hdc As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long