Hacker News new | past | comments | ask | show | jobs | submit login

A z-buffer solution will not help as soon as you involve transparency. Which I'd assume is the case in 99℅ of applications. Unless your application/game is all boxes :)



No, transparency is actually quite rare in games, for pretty much this exact reason, and outside of games is rare to have more than one or two layers of transparency.

The typical method is to draw all opaque objects first with zbuffering enabled. Then sort all the remaining trasnparent objects by depth and draw them from back to front


I didn't discuss transparency because transparency handling comes more or less free with a graphics engine.

That's besides the point that partial transparency is actually intentionally used very sparingly in games because it's computationally expensive.

In the same sense that you almost always start a web app front-end with some JS framework, you almost always start a 3-D game with some graphics engine. Graphics engines generally take care of the depth sorting for alpha blending for you.

If you're building your own graphics engine, then I'd mostly just question whether you really need to. Sure you might make something leaner, but the benefits will be marginal at best.

In other words, yes, you're right, transparency complicates things, but it's a well-understood problem and the solution is more or less free with the package when you pick up a graphics engine.

Of course, when you really dig into the bowels of the problem, you'll notice that most graphics engines don't gracefully handle the circular overlap problem. In practice, it's more efficient and lower cost to just cut the object up at asset creation time than to dynamically split things at render time. That means you're just avoiding the problem, but it's a rare enough corner case that it's just cheaper to work around the corner case.


Boolean transparency can be performed in any order, so you can use non-boxes straightforwardly. It's only semi-transparent textures or alpha-blended objects that need more help if they're to be blended correctly relative to each other (and most situations will involve particle & sizzle effects, which don't need true correctness anyway).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: