Sunday, April 1, 2012

Reflection Attempts!

Yesterday I got the framebuffers working and today I've been messing with the reflection shader. Right now the code is inefficient in many ways, but it is starting to resemble proper reflections. Anyway, here are some pictures I've taken throughout the process:

I'll be discussing the last three images. All of these have been running on my laptop's bad graphics card, so I expect a speedup on my dekstop. Speedup will also come with making the shader more efficient. I'm aware of at least one major slowdown at the moment, which is I'm advancing the ray in view space and converting to screen space every step, rather than converting the reflection direction to screen space from the start and only working in screen space from that point on. I was doing this initially, but I encountered some problems so I said screw it and did it the slower way. The jagged lines correspond to the ray step size. The smaller the steps, the more refined (but slower).

Also, you may notice in the final image that the reflections do not draw the backfaces of the spheres. This is because the framebuffer can only store one color value per pixel, the front pixel. Since we are accessing the framebuffer to get the reflected color, it will not find anything for the back pixel.

One interesting thing to point out is there is a cool shadowing effect on some of the walls. I'm not totally sure how this happens at the moment, but it is definitely cool.

Clearly there is a lot more work to be done in terms of visual quality and speed, but at least my results resemble proper reflections.

1 comment:

  1. Good progress so far. I'm looking forward to your optimizations and performance analysis on a desktop card. Right now, the frame rate is very low for this to be practical.