Download

Why is alpha so bad for performance?

Hi. I have recently come from Cryengine and I am currently converting my project to Unreal Engine 4. The newest one. As much as I love Unreal over all other engines, although I am quite new to it, I am very curious why is alpha stressing engine so much? I am comparing everything to Cryengine with which I spent 6 years, so I don’t mean to offend anyone. I am just wondering if there is a way to fix it or is it the way it should be?
So… Our project will have a lot of fooliage… grass, trees etc. The problem is that alpha in Cryengine was like literally nothing to performance. Engine treated it like if it was non-existing performance-wise. Now we are converting to Unreal engine, but this seems to be obstacle, because in F5 view, alpha that has another alpha behind it seems to be extremely stressful (all alphas in red!) for the GPU I guess. Although I work on GTX 1080, but tested it on various machines. So… we have very low low low poly grass, literally 1 plane. But when we switch on the alpha, fps drop DRAMATICALLY. Is there a way to avoid it? I can’t seem to believe that engine that much more powerful and great than Cryengine has trouble handling that. So I thought there must be some trick. Thanks for any answers!

Any time you draw with alpha blending, you multiply the cost of that pixel by the number of layers of geometry you have, no matter what engine you use. Maybe the grass material used in Cryengine was a lot simpler than the one you are using in Unreal.

You need to use an opacity mask, if you aren’t already: https://docs.unrealengine.com/en-us/Resources/ContentExamples/MaterialNodes/1_8

In our own project we’re fading out all ground cover at around ~10 meters from camera to maintain an acceptable framerate. Never had to do such things in cryengine.
As you go you’ll notice everything else (In terms of rendering) works faster in cryengine as well. Most of which are impossible to use at production capacity in UE4 and you have to accept that i.e you’re not gonna be able to use POM on your terrain layers due to the massive performance cost. But eitherway, me too, have no idea why rendering foliage works so much faster in that engine.

I don’t know what CryEngine does now, but you can alleviate the high cost in the BasePass from transparency by computing the transparency in the cheaper Depth Pass. It’s in the project settings as something like, “Masked Geometry in Z-Pass.” It’s a pretty common workflow now for games heavy with foliage.

This is still a trade off though. I want to say it forces a pre-pass again. But alpha-test geo can be rendered faster in the depth pass, provided the alpha-test geo isn’t high in poly count. I think a reasonable way to look at it is if you keep your cards relatively simple, the depth pass should be okay, but if you cut out your cards down to the opacity mask, you might be better off not doing it in the depth pass since you’re already cutting out so much transparency with geo.

Alright then, I’ll definitely try that out. But yeah, this is weird. Cryengine has gone to the dogs, especially lately with everything, but it seems to be capable of rendering faster even than so well customizable engine as Unreal. Can we count on this being improved in the future?(Question to Epic)

Well in UE4 draw calls is the new polycount as to performance hits and it’s been suggested that in quantities it would be better for performance to model the foliage and avoided the use of of excessive alpha masks. Another option is there is two types of masks. Transparency which can make use of a gradient and a black/white occlusion mask that has a less performance hit than the transparent version so a less complex shader could be used as an LOD.

Another feature that has been add as of recent is auto LOD for static models as well as the ability to make use of LOD groupings, which I’m not up on and some real cool distance field effects for shadows

So the question in my mind is I don’t think Cryengine handles alpha better but rather what magic tricks it does to offset the performance hit?