Author Topic: How many pixels can be raymarched/raytraced per second?  (Read 3217 times)

0 Members and 1 Guest are viewing this topic.

Offline spathi

  • C= 64
  • **
  • Posts: 78
  • Karma: 5
    • View Profile
Hey guys, quick question here.  How many pixels can be raytraced or raymarched per second on a mid-range CPU these days?

The application is this:  I want to do a game similar to 80s style games where there were a limited number of sprites active on screen at once.  The sprites will be depth sprites with a color map (texturemap), a normal map and a height map.  If the sprites were 64x64, how many of them would it be possible to raymarch per second?

Further, what if the raytracing was cached for a few frames?  EG. we raytrace four per frame, and we have a total of twelve onscreen at once, so the shading and hilighting only updates for each object once every three frames?  Are getpixel routines fast enough for this?

Furthermore, perhaps even tilemap tiles could receive some sort of dirtyrect treatment-- the initial picture of a tile would be raytraced, but tiles under the effect of a light or shadow (determined by quick and dirty methods) might also be raytraced.

What if the main light is coming from a standard direction, eg. 45 degrees?

Of course any rational person would use OpenGL.  But I am not a rational person.

Am I chasing my tail here?

Let's say we allowed ten to be raytraced per frame.  If they were 64x64, that ends up being 6400 pixels, or an 80x80 window.  Surely even midrange PCs could handle that, yes?
« Last Edit: January 11, 2013 by spathi »

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Depends very much on the actual implementation of your algorithm.
On the one hand a brute-force ray-marcher runs easily a hundred times faster on a gpu than on a cpu - but that's because it was designed to run on a gpu.
On the other hand a cpu can use a lot of optimizations you cannot use in gpu code, eg simply start the marching near the hit-point of your previous pixel or use bounding hierachies to minimize iterations.

I'd suggest to just try it and see if it's fast enough.
Challenge Trophies Won:

Offline spathi

  • C= 64
  • **
  • Posts: 78
  • Karma: 5
    • View Profile
You're right that I should try it.  I can have precomputed distance fields and real raytracing might not be necessary if I could get specular and shadow.