Quick Search for:  in language:    
FPS,IDEI,Updated,Bill,instead,runs,Which,asto
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Xp Frames , Xp List Box And XpTextBox (updated!)
By ali s on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Excel Into a webpage
By Bill Donahue on 7/2

(Screen Shot)

Unroll2 - Update
By Cyber Chris on 7/2


MultilinePWD
By Cyber Chris on 7/2


Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Realtime simple raytracer (updated 30 April 2002)

Print
Email
 
winzip icon
Submitted on: 3/1/2002 7:02:12 AM
By: Almar Joling  
Level: Intermediate
User Rating: By 49 Users
Compatibility:VB 6.0

Users have accessed this code 8910 times.
 

(About the author)
 
     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.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 12 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
3/1/2002 7:45:17 AM:Nigel
Very Impressive!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 10:21:13 AM:Robert Rayment
Nice maths & imaging 5/5  I get about 
10 fps for exe on my 400MHz m/c.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 10:52:07 AM:KaoS
Pretty cool code!
I get 15fps on 
900MHz PIII.
I like it...more stuff 
like that!
THX
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 12:23:53 PM:gonchuki
poor performance for a 900 Mhz!!! i get 
21fps on my 672Mhz AMD Duron... and 
28fps with all tricky switches on... 
still have to see if i can optimize the 
code. 
Good Work!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 12:57:35 PM:Feuchtersoft
Neato. I don't get a single frame per 
second, although it's cool, nonetheless.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 1:34:48 PM:Almar Joling
Feuchtersoft: Did you compile it? If 
not, you really should. running the 
program from VB is _very_ 
slow
<P>
I'm aware that there is a 
difference between Intel/AMD machines. 
I'm not sure what causes it, but I 
guess it depends on some optimizations 
VB adds.
<P>
If manage to optimize 
the code more (besides moving the math 
inline), I'd like to hear it 
=-)

Almar

Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 1:55:47 PM:...tHe_cLeanER... / jB
LOL, i get 3fps on my Athlon 1.2ghz!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 2:44:09 PM:Almar Joling
Did you compile it???? If not, then... 
well something is really taking up 
clock cycles on your PC.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 2:44:58 PM:Jason Hensley
I get 42fps on my AthlonXP and Radeon 
DDR VIVO video card.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 2:45:41 PM:Jason Hensley
I'm getting 46fps now
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 5:26:36 PM:eXQue
Very nice program got 4 with my 1.2 
Ghz
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 5:59:30 PM:Xip3000
89 FPS in my ATHLON 1400 and GeForce256 
DDR
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 6:14:22 PM:Dragonfire Software
Cool code. I get around 29 FPS on a 1.4 
Ghz P4, 256 MB RAM (If that matters 
any...) Keep up the good 
work!
http://dfs.vze.com/
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2002 11:00:19 PM:XNetman
Nice little example with a repectable 
36fps on my machine. You can possibly 
speed up the maths a little by creating 
a look up table for the trig functions 
rather than calculating them each time. 
It would also be nice if you could move 
the light position without pausing the 
animation. Anyway 4 globes from me 
you'll get 5 when you provide support 
for other simple primitives e.g. cubes, 
pyramids.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 1:08:21 AM:Feuchtersoft
Ah, I just compiled it. 33 fps. Ha! I 
should probably read instructions next 
time.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 12:55:59 PM:Hans J. Reich
You get a five - very nice, and I like 
to see graphics stuff as a break from 
all the winamp players and such.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 1:50:18 PM:Carles P.V.
Simply great!
Good work.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 2:20:00 PM:Jeremy Pettit
25 fps on Duron 850mhz running Win NT 
Server 4 and Direct X 6.    Not bad 
performance considering these factors.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 2:20:11 PM:M. Highlander
i got 0 fps
oh wait you have to run it 
first 
;-)
COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOL!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 2:46:34 PM:Edin Omeragic
15 fps on celeren 500 MHz
i must give 
this friend to try this
on pentum I 
133 Mhz
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 3:43:06 PM:Chris Pietschmann
I got 3fps in the IDE, but 23fps 
compiled, on my 900mhz Athlon. Very 
nice. Could you send me, or post a text 
on how to convert xyz to xy 
coordinates, and lighting and 
viewpoint, and such. I will try to 
figure it out from your code, but it 
would be easier if there was a little 
tutorial on the math that I could 
read.
Very Nice!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 10:45:15 PM:Jamie Lindgren
Really cool. In the IDE I got a mind 
boggling 3 FPS >< but when compiled I 
got 29 (on my 1.5 gigz comp)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/4/2002 10:53:02 PM:gonchuki
someone said would try on a pentium 
133... i tested it on my AMD K5-100 
result: 4 FPS
very good... i get the 
same in IDE on my main pc...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/5/2002 1:06:36 AM:havok
Nice program, u need votes.  So u got a 
5 from me.
Good job Almar, your 
coding seems to amaze me, doing stuff 
that other people don't even think 
of.
[havok]
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/7/2002 8:57:57 PM:Schitzn
I get an error relating to an undefined 
function/sub:  Could someone email me 
and tell me why I can't seem to find 
the 
sub/funct:
"GenerateRayDirectionTable"
I have the DirectX 8 reference 
listed without error?  Ideas?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/8/2002 2:40:50 AM:Almar Joling
I first used the math functions 
contained in DirectX, but they were 
slower than a simple VB version of 
them... I forgot to remove the 
reference. About your problem, the sub 
is really there! I'm always running 
with Full compile, never seen the error 
before. I guess it would't compile 
without it either, =-). The sub is in 
mdlMain, almost on the top I 
believe...

-Almar

Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/9/2002 3:22:41 PM:xmetrix
53fps on athlon 2000xp 1.67@1.8ghz 4gb 
ddr, radeon 8500 64mb ddrAGP, scsi hd, 
winXP pro directx8a
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/14/2002 9:04:16 AM:Shlomo
very nice 8 fps on my PII 350MHz
but 
it takes 100% cpu usage.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/16/2002 6:47:19 AM:Almar Joling
Yeah, it uses a simple do...loop, with 
just one DoEvents. It doesn't give 
Windows much time to breathe =-). 
raytracers are known for their required 
power, that's why we still do not see 
any large real-time raytraced 
animations yet.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/25/2002 11:26:20 PM:Kevin m F
cool, but you need a fast comp to run it
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/26/2002 6:52:27 AM:Almar Joling
Yeah...realtime rendered scenes won't 
exist for the next years anyway. It 
requires so much calculations. That's 
why raytracing a simple (3D) scene on a 
post-stamp format can still take 5min 
on a 500Mhz..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/26/2002 4:58:58 PM:Almar Joling
I do like to know why Tim Sørensen has 
give me a vote of 1. Didn't it work? 
You're the only one that has voted so 
low, so please I'd like to hear why so 
I can modify the code as needed
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/30/2002 6:33:55 AM:renekersten
hey very nice! i get about 10 fps on my 
p2 400 mhz. you get five stars from me
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/31/2002 2:05:34 AM:Carlos Ruvalcaba
a Really nice one, 2 fps IDE, 4 fps 
Compiled, in my Pentium 200Mhz, 5 
Globes from me!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/17/2002 5:05:06 PM:Bill Soo
I got 15fps on my 500mhz. I added ALL 
the compiler optimizations and got that 
up to 19fps. I then got rid of 
SetDibits and used direct memory 
writes. That improved the speed to 
22fps. Finally I replaced the GetFPS 
function with a simple timer control. 
That brought the speed to 
24fps.
Total improvement...60%.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/17/2002 11:43:03 PM:Adriano Paladini
47fps on my AMD K6-III 450mhz with 
GEFORCE 2 MX-400 (32MB).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/18/2002 1:40:09 AM:Almar Joling
Bill: I would love to see that code :). 
Although I think the timer control's 
precision (which is bad!) is increasing 
the FPS. Although the timr control does 
run in it's own thread..hmm
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/18/2002 8:05:36 AM:Ozan Yasin Dogan
Intel PIII-450mhz Leadtek Geforce2Mx 
Running at 210Mhz, 11 fps
Nice code 
but still slow..
Graphics --> C++ 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/18/2002 12:50:47 PM:Bill Soo
The timer control has poor resolution 
(~55ms) but that doesn't matter much 
since you are sampling a fairly large 
time interval (1000 ms). The big time 
savings is due to the fact that the 
timer control only fires every second, 
thus it only has to update the caption 
once per second, instead of 22 times 
per second. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/19/2002 4:38:39 PM:Bill Soo
I replaced the frmMain.picRay.Refresh 
statement with the InvalidateRect API 
call to which I passed a small rect 
structure that was just the part of the 
picturebox containing the spheres. This 
forced a repaint of only a section of 
the picturebox, rather than the whole 
thing, resulting in a frame rate of 
33fps.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/19/2002 5:40:20 PM:Bill Soo
The rotate and shadesphere functions 
are pretty fast. Where the time seems 
to be consumed is in the TraceScene 
function (which calls shadesphere true, 
but shadesphere is a small fraction of 
the total time). So I took a look at 
this code and made some small 
optimizations that gained a fps. Then I 
got rid of the MySphere and 
ClosestSphere variables and referred 
directly to Spheres. This gave me a 
huge increase from 33 fps to 
49fps!
So total optimizations went 
from 15fps (original code) to 49fps....
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/20/2002 2:49:52 AM:Almar Joling
I believe it's faster than the original 
C++ version then =oD. Good work!! 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/20/2002 2:50:51 AM:Almar Joling
btw, if you email me the updated 
version, I'll update this submission. 
-Almar
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/28/2002 8:20:02 PM:HurroTisRobbo
Top stuff! 5 globes!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/29/2002 6:34:27 PM:Juan Martín Díaz
Is this submition updated with Bill´s 
code?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/30/2002 2:13:06 PM:Elan
I pulled 40fp/s nice.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/9/2002 8:11:49 AM:Exeat
My Pentium I 166mghz got a suprising 11 
FPS - I honestly expected to get a lot 
less, well done.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/20/2002 5:40:29 AM:Luke
Very nice!  62fps on a Intel 82810 
Graphics Controller!!  800Mhz Athlon, 
256Mb RAM.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/16/2002 11:16:30 AM:thri-p
Getting an average of 145fps. I'm 
running on XP, Athlon 1.2ghz, 640mb 
SDRAM, Leadfast Geforce2 Ultra. Nice 
codes. 5* :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/7/2002 2:37:26 AM:Nelson Oliveira
very nice 49fps on a celeron 466
5 
globes for u
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/7/2002 8:18:27 AM:Timon Albers
Why do all of you got so few fps? I got 
about 220fps. -> Athlon 1800+
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/7/2002 11:56:49 AM:
Very impressive code. Ran icredibly 
fast here at 150-250 fps on a Athlon XP 
1700+, 512 Mb ddr mem and a Radeon 8500
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/7/2002 12:45:54 PM:Christopher Rouse
It worked V slow in the VB IDE I got 
about 8-12fps, but when it was compiled 
it was to fast about 200fps on my 
Athlon XP 2000+ and 512mb of ddr mem 
and a geforce 3 ti 200.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/7/2002 3:59:12 PM:Almar Joling
I'm wondering why there is suddenly so 
much interest for this code :P. A link 
somewhere?
-Almar
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/7/2002 6:43:38 PM:john sheridan
I think your code won code of the day, 
so its in all the mailing list emails 
that go out everyday. But thats wierd 
cuz this is like a year old...
btw, 
this code is amazing - i got 15 fps in 
the IDE and 135 FPS! when its compiled 
5 globes from me
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/24/2002 10:07:06 AM:Peter Wilson
Hmmm? If this is really ray-tracing (of 
which I have seen no real evidence thus 
far), then let's see some reflections!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/24/2002 10:09:54 AM:Almar Joling
Peter Wilson: There is another version 
of my raytracer which has shadows, 
reflections and stuff..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/17/2003 1:18:38 AM:
Impressive work, I'm averaging 230fps 
on my AXP 1800
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.