There’s some debate going on in our studio about the pros/cons of using alpha instead to modeling the “holes” in geometry.
The way I’ve understood it is this, please correct me if I’m wrong:
when using an alpha for making holes in the geometry, this adds one drar call, so the polygons will be rendered once more with the alpha on, and of course the polygons behind the alpha will have to be rendered too, instead of being culled.
So, when there’s a polygon with alpha map on, it’s like rendering two polygons without alpha?
This is still far more beneficial performance-wise than rendering an object with the hole modeled into it, having most probably to use at least 6 triangles in it only for getting the thickness to the object (if the hole is a triangle, which is the simplest), am I not right?
So, even though the alpha-map requires one more draw call, there’s really no realistic case where rendering polygon-modeled holes would be more performance friendly?
I’m really curious about this subject at the moment…
If you can get away with uing the geo holes and not using alpha at all then you are going to be saving texture memory. With DX shaders adding an alpha channel will double the size of the texture, so for a few polygons more you’d likely be more efficinet just cutting the hole in the model.
I’d not try that as a replacement for alpha hair or a chain link fence though!
If you’re using a 1-bit alpha channel and a punch-through (non-blend) alpha then you’re performance shouldn’t suffer. If you’re using a 4- or 8-bit alpha with blend, you’ll have pay the overdraw cost of rendering the same pixel at least twice and you’ll have sorting issues to deal with. Additionally, unless you’re anti-aliasing the render, small geometric details with cause unwanted noise and “jaggies.”
Which method you use will depend on the situation. Like the aforementioned chainlink fence or leaves of a tree, stick to the alpha channel–but for the finger-hole of pistol or anything you want to get close to, model the detail.
You’ll want to profile your scenes to determine if you are polygon bound or fill-rate bound. Usually it’s fill-rate.
There is no other reliable way to guage performance questions like this. If you are on XBox or PC, use PIX. If you are on Ps3, I don’t know the exact profiling technique, and if you are on an embedded platform, well then your question gets really interesting.
Here are some general observations from my experience though…
[ul]
[li]If you are worrying about 6 polys, you are optimizing the wrong thing.
[/li][li]Graphics cards like to draw things fully opaque. Appease them when possible.
[/li][li]If you are pixel bound in any way, overdraw is going to hurt a lot more than anything else.
[/li][li]Depth Buffering is your friend. Whatever you do, don’t mess up the HiZ.
[/li][/ul]
If I were stabbing in the dark at your situation, I would guess that a naive implementation of polys will be faster than a naive implementation of alpha, but that optimized versions will have a negligable difference. Therefore, do what you think looks best.
The whole debate here - I think - was theoretical, just wondering which is generally best.
So, the more the platform can render polygons, the more they should be used, unless the alpha looks better?
The “6 triangles”-thing I mentioned was just an example of the simplest case where you would have to make a choice: a triangle shaped hole.
What if the device was a mobile phone with the realistic ability to render around 10000 shaded polygons each frame and with around 16mb batch video memory?
Depending on the type of the game and the object to be modeled for a mobile platform like this, I’d personally prefer using alphas on planes as much as possible, as opposed to modeling more complex 3d-shapes for each object.
What are your opinions?
When the rendering performance is extremely limited like this and there’s only very little video memory available, what would you prefer?
Modern hardware of PC and Consoles may favour more polygons, older hardware may favour alpha or (ideally) 1bit. With unknown hardware you really need to benchmark it, and make tests. Without knowledge of the platform you can’t say whats better.
I’ve always done the texture vs. poly calculation when making these decisions…assuming no real graphical difference…on every machine. Even on the DS texture memory can be less of a premium than vertex/poly rendering time (There is a hard limit to how many verts you can render on the DS) and on the Wii, a compressed texture is pretty small memorywise, but if I need an alpha channel greater than 1 bit, it can take up 4 times the memory.