Fastest way to do a software renderer

Hiya

I was playing with the idea of doing some real time ray tracing in Java. I found that I could get 50fps for a smallish render size so I thought that interpolating the pixels to get a reasonably enlarged image would be a good idea. Problem is that the setpixel stuff really hosed the frame rate. I’d used the create compatible buffer approach to get something that I thought would be reasonably fast to write to.

My question is: with current technology, what’s the optimal approach to software pixel pushing in Java? Should I even be using BufferedImages? Would I be able to get better performance from an OpenGL buffer, or maybe using SDL?

Anyone done anything like this before?

For my java realtime raytracter i directly manipuated the backing Int buffer of a RGB Buffered Image:

to get the backing buffer:


BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
int[] imagePixelData = ((DataBufferInt) image.getRaster().getDataRasterBuffer()).getData();

to render a pixel:



imagePixelData[pixelY*width+pixelX]= (int) (intersection.colour.red*255) << 16 | (int) (intersection.colour.green*255) << 8 | (int) (intersection.colour.blue*255 )


then just draw the image to a graphics object.