Sunday, April 27, 2008

Phong Shading

Silverback3D now officially has Phong shading (example here). The code actually isn't very different than the Gouraud shading code, since it is still interpolating values over the surface of polygons.

I might write up a more detailed post on this later, but for those of you who don't know: while Gouruad shading interpolates color across a polygon, Phong shading interpolates normals across a polygon and then calculates the color of each pixel individually. While this takes more processing power, it allows for much more advanced rendering. As you can see above, the Phong shading (right side) creates much more defined and realistic specular reflections than the Gouraud (left).

In addition to creating better looking specular highlights, Phong shading can be used for much more diverse things, like this simple toon shader that I threw together.

If you're interested in learning more, Wikipedia has a page on Phong shading with some good information.

Saturday, April 26, 2008

Texture Mapping


I've actually had texture mapping working for a while now, but a few weeks ago I decided to go back and re-work all of my base rendering code before working on any more advanced functionality.

This is the current state of the renderer. I was able to add another 1-2 FPS by streamlining my drawing loop counters.

And now the reason for this post: texture mapping. I think it's looking pretty good so far, but there's still some features I'd like to add. Performance doesn't seem to be doing too badly, but I'd like to tweak it to get an extra few FPS if at all possible.

Friday, April 25, 2008

Firefox vs. Internet Explorer


I did some unofficial tests today and it looks like there's a significant performance difference between the two browsers. I get an average of about 25 FPS in Firefox, while Internet Explorer manges to squeeze out about 38 FPS.

In the past I had always advised people to stay away from Internet Explorer in favor of Firefox...but this might start changing my mind.

I did a quick search to see if I could find why this difference exists, but couldn't find anything right away. I'll post again if I ever find out more information on this.

I'm also interested to know how Safari plays into all of this.

Thursday, April 24, 2008

Specular Reflections - Part II

It didn't take me nearly as long as I thought it would to get everything sorted out.

Specular reflections seem to be working just fine now, check them out in the latest demo.

On a different note, I'm realizing that this blog will quickly get dull if it's all text. I'm going to start putting more effort into using more pictures. Starting tomorrow.

Specular Reflections - Part I

One of the last features I wanted to implement for my Gouruad-shaded renderer was specular reflections. I spent a bit of time working on this last night and ran into a few problems, mainly with some things that I had set up in the past that should have been set up better. I'm hoping to get these sorted out tonight after work, and then finish up this functionality.

You can see the current progress here, this example has ONLY specular reflections, there is no diffuse lighting present.

If you're a graphics geek like me, this is a good example to see the true nature of specular reflections with Gouraud shading. Although all of the computations are technically "correct", the way that the polygons are drawn combined with the lack of geometry makes it look less like a shiny surface and more like flashes across the model's surface.

Some more information on Gouraud shading, as well as another visual example of specular highlights, can be see on the Wikipedia page.

And for those of you who want something more...stay tuned for Phong shading :)

Tuesday, April 22, 2008

Performance updates

I haven't had much time lately to start working on any new features, but I've been slowly working on optimizing the main rendering code for performance.

I've done all of my testing so far with the classic 'Silverback' model, which weighs in at around 1500 polygons. I would assume most practical applications of this engine won't be using models of this complexity, but I'd rather push the limits from the beginning instead of running into problems later on.

My goal is to eventually be getting around 30 FPS on any computer for basic Gouraud shading. You can test out Silverback3D's current performance here.

What frame rates are you getting? (I apologize for how hard it is to read the FPS, I'll fix that soon...)

EDIT: I've updated and replaced the above example. Frame rate should be much easier to read now.

Monday, April 21, 2008

Welcome

...to my new blog!

I'll kick things off with the announcement of an official name for this project: Silverback3D. I figured that this had finally evolved into an actual, cohesive project out of the various experiments that it began with. I'm very happy not only with the progress that I've made so far, but also with the things that I have learned about 3D graphics along the way.

Please keep checking back, and I will do my best to keep this blog updated with news, examples, and eventually code for the public to use.