VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Realtime simple raytracer (updated 30 April 2002)

Almar Joling  (9 Submissions)   Graphics   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

Updated by Bill Soo... instead of 25 fps, it runs at 60 fps now! Which is an astonishing framerate for VB
Again some pretty unique code from me. This program is a _realtime_ raytracer (not raycaster!). I ported it from C++ to VB, and it still runs pretty fast. It also shows you how to use SetDibbits to change all the bits in a picturebox with just one call. You can zoom in and out, add more spheres by changing a few variables/constants in the code. Light-positions can be set by the scroll bars and changes will be visible directly!
Note: Please compile this program, or you will receive ~1-2 FPS from the IDE.
I would appreciate some votes, people, so that I can still think my (unique) work is appreciated =-)
Update: I've moved some math functions inline, and improved the code wherever it was possible. 10fps more now! Do not forget to compile the program though... Original source is also included. I'd really appreciate if you vote for this code guys.

Assumes
I assume that you have some knowledge about "what a Raytracer actually is"

API Declarations
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private 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

Rate Realtime simple raytracer (updated 30 April 2002) (51(51 Vote))

Download Realtime simple raytracer (updated 30 April 2002)

Realtime simple raytracer (updated 30 April 2002) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters