View Full Version : Best option for displaying multiple, overlapping alphas in Max viewport

08-21-2011, 11:57 AM
I'm curious as to what peoples solution for realtime display of overlapping alphas is in Max.

I've been messing with some foliage lately and have not had much luck getting anything to display very nicely in anything other than UDK, which is fine when my model is done, but whilst I'm building the model, it's not ideal.

So I've got a bunch of overlapping planes with a lot of alpha, the minimal amount, but these are tree foliage cards so there's obviously a fair amount. The problem I'm having is that either the planes closest to the camera obscure everything behind, despite being 'transparent', or they are invisible from the back.

I know this is an age old problem and there's technical explanations behind it, but I'll be the first to admit, I have no idea what alpha test, or alpha sort mean, or why alphas don't display properly.

I've tried detaching, reattaching, both to no avail. It's also a pain when there's loads of cards to sort through.

In terms of shaders, I've tried Xoliuls (I've edited the text inside the shader as someone suggested to get two sided alphas working), and I've tried 3Point. Max's default Standard shader is the closest I've got to anything satisfactory, but it's not a DX shader so image resolution is terrible in the VP and there's no normal maps.

I gave it a quick go in Maya, and the standard shader in Maya seems to have no problems at all, I can stack as many cards on top of each other as I like and it has zero issues displaying them just fine. I don't have Maya at work though, so I'm looking for a Max solution.

I'm using Max 2011 if that's important.

Mark Dygert
08-22-2011, 04:52 AM
This is something max struggles with. Sorting opacity maps especially if they are stacked takes forever the more transparent pixels there are on the screen the more sorting it has to do. It's always faster to do it with geometry rather than opacity maps or reduce the number of trans parent pixels by cropping the geometry very close to the opacity map.

Max just hasn't ever been optimized like realtime engines to handle opacity effectively and alpha sorting is one of the hardest most complex things for max to figure out. I'm not sure if you can force max to alpha test or if that is any faster(in theory it should be...)

Maxs alpha sort is almost as bad as trying to raytrace reflections in realtime, it can take several min per frame when just rendering to get the sorting right. It might be better in 2012 if your using the Nitrous display driver, but you need a monster video card and I can't be certain about how well it sorts opacity...

So... Crop those cards as close as possible.

EDIT: Oh and the difference between Alpha Test and Alpha Sort (at least how it was explained to me) was on the right you have Alpha Sort, on the left you have alpha test.
Alpha sort: is a complex set of checks that gets bogged down by figuring out how much can be seen through each semi transparent pixel. This is the mode max defaults to and I don't think it can be forced into alpha test... maybe it can and I just never found it.

Alpha test: is a simple on/off check the pixel is either 100% transparent or its 100% opaque. There is no in-between. Can I see through it, yes show everything behind it, done.

If you have an opacity map that has semi transparent pixels(left image) and its set to alpha test, they will be rounded up or down so it is forced to operate like the image on the right. This is what Unreal defaults to and in general if you throw too many Alpha sort transparencies at Unreal it chokes like max does.

Alpha sorting goes something like this:
Max: Is this pixel transparent?
Render: Yes, partially... oh god, what do I do, whatdoIdo, whatdoIdo!?
Max: Don't panic, how much and what else can you see?
Render: WAIT we found another transparent pixel on another object, and another and another. OMG!? Its transparent pixels as far as I can see!?
Max: Calm down, did you find an opaque pixel yet?
Render: Yes... oh thank god... We're saved!
Max: Figure out what you can see through the deepest transparent pixel and work out what the solid color of that pixel is. Then figure out what you can see through the next and work out the final solid color. Do that to the next and the next until we get to the foreground, I'll wait while your brain explodes.
Render: Done...
Max: I'm sorry what?
Render: I said I'm done. What do you want me to do now?
Max: Oh that. Yea don't bother. The user left 3 days ago, thanks for being so speedy...
Render: /suicide

08-22-2011, 04:56 AM
Thanks Mark, good to know I'm not the only one having problems.