Home Technical Talk

AlphaMap Or Geometry?

I have been thinking about this for a while now...

In a "current gen" game(engine). Would it increase or lower the overall performance if one were to use this technique (see image below)
to lower the polycount on objects that otherwise would have alot of "unnessesary" triangles on flat areas(cylindrical shaps for example)

Xgz9k.jpg
qdXUS.jpg



-will it even look right in a scene that uses dynamic lightning?

-will mipmapping become a big issue?

-Is it "just not worth it" if there only is a couple of objects using this this technique versus lets say 100?
( I did get a better fps with the alpha cylinder in a quick test with 12 non-alpha VS alpha cylinders, inside Blender Ge)



-To decrease the risk of getting jagged corners. Is it worth having a large(1024>) alphamap shared among various objects (so that each object has two different UV-maps) with "basics" shapes like this?

YGuwG.jpg


This is some of the questions that have been floating around my head for a while now.

If someone has a good answer regarding this feel free to fill me in :poly121:

Replies

  • Elyaradine
    Offline / Send Message
    Elyaradine polycounter lvl 11
    It kind of depends on the platform and context (i.e. what your bottleneck is), but as far as I know, verts are generally cheaper than overdraw/empty pixels/pixel calculations.

    Where transparency may work out better is if this stuff appears really far in the distance, at which point it takes up so few pixels that the verts become more expensive. (But arguably a bigger bonus would be that you get "free" antialiasing because of the mips.)
  • Farfarer
    In this case, I'd definitely go with tris.

    Less draw calls, less overdraw, less textures, less transparency testing. Geometry is cheap :)
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    tris, the z-sorting and overdraw, for the alpha support will cost more than a few tris.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    also, less hassle with tris ;)
  • Kurt Russell Fan Club
    Offline / Send Message
    Kurt Russell Fan Club polycounter lvl 9
    Alpha's not going to cost anything because you'd use alpha test not blend.

    But unless you are making Wheel Wars in Cylindertopia these are going to only ever be a fraction of your scene. The tri count saving is so small that the extra texture space you would take up and the faffing around matching the circle radiuses make the no alpha version way better
  • Stoop_Kid
    I've been wondering a question like this too, thanks all for the advice! :)
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    a single extra texture is a lot more memory than an extra 16 tris. You'd need to be saving thousands of tris before it was worth it.
  • Farfarer
    Alpha's not going to cost anything because you'd use alpha test not blend.

    But unless you are making Wheel Wars in Cylindertopia these are going to only ever be a fraction of your scene. The tri count saving is so small that the extra texture space you would take up and the faffing around matching the circle radiuses make the no alpha version way better
    Alpha test still costs. It's an extra conditional and draw call that's not required.
  • JamesWild
    Offline / Send Message
    JamesWild polycounter lvl 8
    I've seen something similar done before where the caps of a cylinder were slightly larger and higher poly than the side.
  • swepower
    Alright, thanks for the input guys.
  • cupsster
    Offline / Send Message
    cupsster polycounter lvl 11
  • Kurt Russell Fan Club
    Offline / Send Message
    Kurt Russell Fan Club polycounter lvl 9
    Talon, yeah you're right that it's not identical to not doing it. In the realms of optimisation it's more like dropping a friend home who's on your way as opposed to making a whole extra trip halfway across town.

    It's an extra shader instruction, and it does mean you're filling extra pixels that you wouldn't otherwise need to shade. But you don't need to alpha sort them and you don't need an extra draw call (unless you're saying you'd use two different passes for the two parts of the cylinder, but you wouldn't because of the extra draw call.)
  • Farfarer
    Talon, yeah you're right that it's not identical to not doing it. In the realms of optimisation it's more like dropping a friend home who's on your way as opposed to making a whole extra trip halfway across town.

    It's an extra shader instruction, and it does mean you're filling extra pixels that you wouldn't otherwise need to shade. But you don't need to alpha sort them and you don't need an extra draw call (unless you're saying you'd use two different passes for the two parts of the cylinder, but you wouldn't because of the extra draw call.)
    Yeah, you're right it's not too much of an extra cost to alphatest.

    I imagine it'd be an extra draw call because it'd be a new shader and/or a different texture.
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    you guys are going too indpeth for the simple question asked by the OP.

    and if the OP is worried about the performance difference between the 2, well wtf.
  • JamesWild
    Offline / Send Message
    JamesWild polycounter lvl 8
    As far as I can tell, alpha test is implemented very similarly to depth testing. When using straight-up OpenGL/DX, you can turn it on/off without changing anything else.

    Doing so though however requires a separate batch to be sent up, thus a separate draw call as you say.

    Also, I don't know if UDK would be intelligent enough to notice that two materials are identical save for one flag being different, might do the relatively expensive shader switch regardless. Or if there's another way to switch the alpha test state.

    Also, a batch with just a plane in it, is not terribly efficient.
Sign In or Register to comment.