Home Technical Talk

How efficient are alpha maps?

polycounter lvl 18
Offline / Send Message
Zwebbie polycounter lvl 18
Just a short question: how do you determine when to use alpha maps and when to model something? It's a more easily answered question for next-gen models, but I'm often in doubt with the lowpoly models as are now seen aplenty in the contest section.

A lot of people use alpha maps to save polygons, but from what I've noticed, they're pretty taxing themselves. Are things like caps of wheels or gun triggers better modeled out or alpha'd when dealing with low polygon models?

Replies

  • Eric Chadwick
    Depends on how much that surface is going to slow down rendering. Alpha is slower than more triangles, in general.

    Also it slows things down when the engine has to do a "state change" in the middle of rendering a model. You don't want the whole model to have the alpha in its material, too slow, a waste of rendering speed. So you segregate it, so only some of the model has the alpha and the rest doesn't. But then this has its own cost, the engine has to stop to send each set of vertices (material) separately (a state change).

    Best thing is to do some tests, depends a lot on the hardware, your engine, how much screen space the model takes up, etc. Compare the different methods, see which hits framerate more.

    Alpha test (hard-edged alpha, commonly used for tree leaves) is slower to render than a bunch of triangles alone. It does have aliasing artifacts since it isn't antialiased, but then again doesn't have any sorting problems. Makes sense for tree leaves because triangle-only leaves would be way too taxing to transform.

    There's a newer method for alpha test called "alpha to coverage" that introduces antialiasing but it has fixed levesl of transparency, for example 6 or 7 levels of gray. Still fairly slow though.

    Alpha blend (soft alpha) looks better, uses anti-aliasing and texture filtering. But... it is slower than alpha test because every pixel has to be compared with the z buffer, and even then it suffers from sorting problems. Have to use it sparingly, unfortunately.

    Hope this helps.
  • Tumerboy
    Offline / Send Message
    Tumerboy polycounter lvl 17
    it used to be that alpha was cheap and polys expensive. . . now it's mostly flipped.

    If you're trying to figure it out for work, then work with your programmers, they should be able to help you figure out a good balance for your engine.

    If you're trying to figure it out for a demo reel, then just do it the way you think it should be. If in the interview someone asks why you bothered modeling something instead of using alpha, or vice versa, simply explain that you thought the way you did it was going to be more efficient. Even if you're wrong for their engine, that should at least let them know that you were thinking when you did it, rather than not having a reason.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    alphatest = masking, is still rather cheap, the blend stuff (soft) is more of a culprit, as Eric said.
    When you look at the insane amount of plants that are rendered today, and nearly all use tons of alphatested billboards, imposters... it's definitely not a "slow" thing. (else we would have modelled leaves wink.gif )

    even on PSP and mobiles and a like, you would still favor alphatest over polys. As polys often means more vertices, which adds to "transform costs", which on such platforms is still fairly limited. While the amount of pixels shaded (with tris or with alphatest) would stay similar...
  • Zwebbie
    Offline / Send Message
    Zwebbie polycounter lvl 18
    Thanks a lot, guys. Lots of things I didn't know smile.gif

    I'm afraid I don't have any programmers or engines yet. I'd try some stuff in Blender's render, but it's rather unreliable (for example, it prefers to render a cube that's subdivided to thousands of triangles over a normal cube just because it takes up less screen space). I was curious about the issue since from the current competition, it's obvious some people like to use alphas whereas others try to avoid them when possible.

    From what I understand, alpha blend is better avoided unless it's impossible to recreate the effect in any other way. Using alpha test is good if there are quite some triangles to be replaced with it, but for simple stuff, a triangle or ten is less taxing. Is this correct?

    I'd also gather that for a trigger and trigger guard on a weapon, it's better to use 10 triangles to model them, rather than use an alpha. And because they don't have all straight and perpendicular lines, the anti-aliasing of an alpha test would look worse than the vector-ish polygons.
  • Tumerboy
    Offline / Send Message
    Tumerboy polycounter lvl 17
    Yes, things like triggers are a fine use of polys unless this is a DS game or something. But in that case it's probably not even important to be able to see through the trigger guard anyway.

    Alpha is often saved for intricate foliage (ferns etc.), hair, and other intricate details that would cost far too many polys to reproduce without alpha.

    A sort of in between option is to use a couple extra polys to cut off as much alpha as you can. i.e. if you have a circle mapped to a square polygon (where the circle is opaque, and the borders transparent) it is often worth the extra polys to cut off the corners (as close to the circle as you can) of the polygon, in order to remove most of the alpha. That way, it's still calculating alpha, but it doesn't have to calculate as many useless pixels as it would before.
Sign In or Register to comment.