2009-06-11 Every Hero Needs A Theme Song
This is going to be a rant. If you like OpenGL and are offended by alpha blending, feel free to skip to the next section.
So, let's talk about OpenGL. It's based on the idea that all graphical computation should be done in the GPU. (The GPU is an additional processor that specializes in such computations.) The goal is to take the burden off the CPU, so that it can focus on the real work. Just tell the GPU where you are, where the lights are and what the scene looks like. It'll take over from there. In theory this is all working fine. In practice, too. Until you want your entire scene to be semi-transparent. Then it all collapses into a big mess. It turns out that you have to sort your polygons by painting order, back to front. Which is too complicated for the GPU. So the CPU is busy every single time you move through the scene. And it can't be parallelized. Even GLUT (which was designed to add the Utah teapot to the repository) doesn't help there. Not to mention that "sort your polygons by painting order" is not only more difficult than it sounds, but it's also ill posed. Polygons might intersect, and even if not, the center of one might be farther away from the camera than the center of another, and yet be (partially) covered by it. I wish raytracing would be an option in my case.
Of course this is only my personal oppinion. Maybe there's a way to do it properly without much fuss. Too bad I'm not smart enough to find it.
(One simple solution is to set alpha to 0.5 and make sure your model is convex. More clever suggestions? Leave a comment!)
***
I want a Roomba. But I'm not going to get one because every review I've read so far indicates that the customer's satisfaction is inverse proportional to the length of time passed since the purchase. They get worse and worse the longer you own them. And they're too loud.
Still, it's a nice dream. I'm sure Walter would love it.
While I'm at it, I also want an iPhone. Same reason. Same problem. Not going to happen.
***
Speaking of Walter: The little cutie earned his stripes yesterday. He caught his first mouse! These days I normally wake up because he is licking my face, kindly reminding me that I have a job to go to. But not yesterday. He was in the room alright, but didn't jump onto the bed like he usually does. He stayed on the carpet, playing with something I couldn't quite make out in the light of dawn. So I reached out for it, assuming it would be one of his toys. It was soft and still a little warm. I immediately realized what it must be. Gross! But he looked so pleased with himself. I think bringing a mouse to the bedroom is his way of saying that he likes me.
After taking the pictures I left for the bathroom to wash my hands thoroughly. And when I came back, he had already chewed off all four legs and the tail. Not so cute, but what else is a cat supposed to do with a dead mouse?
Walter is officially a hero now, saving the house from vermin. He already has a theme song ("Walter the cat, Walter the cat, he's an itty bitty cuty little cat"), but to celebrate this special day, here's another song about cats:

4 comments:
http://developer.nvidia.com/object/Interactive_Order_Transparency.html
Woah, that looks exciting, thanks for the link!
Peeling off a couple of layers is still a considerable drop in the frame rate (2*n renderings without shadow mapping hardware, as I understand it), but it's nothing compared to sorting an arbitrarily complex scene.
It's worth a try!
Ahem. Not having a clue about the subject puts me in a position to cluelessly comment on this.
What's wrong with convex objects? What's wrong with nontransparent objects? Since when can Godzillas or tanks or aliens be seen through?
Always use topological sorting for those polygons - linear time in number of nodes.
Here's what's wrong in layman's terms:
- Object. Not objects. Singular. The entire scene needs to be convex so that every "ray" intersects twice or not at all.
- If Godzilla had no transparent parts he would be blind. No idea how tanks manage, though.
- Topological sorting is linear in the number of nodes plus the number of edges. But since I'm using GL_FILL instead of GL_LINE, there are no edges, so that's a valid simplification.
If any of that makes more than $0.02 worth of sense I didn't achieve the goal of this comment. But chewing fat beats the crap out of doing what I'm supposed to do (I'm at work at the moment) any day.
As they say: Two wrong don't make a right, but three right make a left.
Post a Comment