3dsmax: baking into vertex alpha channel?

I have some shaders in our game that uses rgb vertex colors for blends, and my plan was to use the vertex alpha to store some ambient occlusion data, however I’m not quite sure on how to get 3dsmax to bake ambient occlusion into the vertex alpha channel, any ideas ?

Even if you don’t find a way to do this directly, you could always do something hacky like bake into the RGB channel then use a script to copy each vert’s R/G/B value into the alpha. Might be easier than trying to find a way to bake directly into the alpha.

I had the same problem in the past and wound up writing a plug-in to generate AO and bake it into the vertex alpha. It was surprisingly satisfying (and straight-forward) to roll my own AO calculator. It is going to be easier, however, to do what Paul has suggested and take the “hacky” approach. 1) store the existing RGB values 2) generate AO and copy the value to the value to the alpha 3) bake the resulting values back into the vertex.

As a side note, depending on how dynamic the lights in your game are, it can be more satisfying visually to make the AO affect all of the lighting, direct and ambient. Though you may want to tone down the affect on the direct lighting.

You can bake the AO as the others said to Vertex Colour - remember you dont have to do it to the channel your using for your blends, just use another channel.

I did start doing my own AO vertex script but didnt have time to finish it as per usual.

Thanks for the input guys, for now I’ve settled on baking a texture with mental ray then using the vertexpaint modifier to throw that into the vertex alpha, its a few more button clicks than i had hoped to have, so i might have to get a real TA to whip up a script to do it.

I might have misunderstood, but there are a few things you can do:

In the Assign Vertex Colours tool you can bake lighting to any channel you choose.

If you have baked it to the Vertex colour channel you can copy that across to the Vertex alpha channel using the Channel Info tool.

You can bake lighting to an object via script:

for obj in selection do(
AssignVertexColors.ApplyNodes obj vertexPaint:obj.modifiers[#VertexPaint]
$.vertexpaint.mapchannel=bakechannel
)

bakechannel is a variable, 0 = vertex colour channel , -1 = vertex illumination and -2= vertex alpha.

Spotted this the other day - reminded me of this thread
Vertex baking AO using CPU or CUDA by Yang Zhang
Max plugin

http://www.zhangy.com/main/index.php?module=documents&JAS_DocumentManager_op=viewDocument&JAS_Document_id=27

Nice one Mikiex pretty much excactly what i need… and fast too!

update: Bugger it doesnt work in 2010…

Q: What’s the definition of a born loser?A: A stowaway on a kamikaze plane. …warhammer Lineage 2 Adena warhammer gold buy wow gold

Hate to bump this older thread.
Anyone been able to get in contact with the author of that Ambient occlusion plugin?
We’d love to get a 2010 Version to use, works great in 2008!

Double bump, just got an email reply from the guy that wrote that AO plugin, he’s released a Max 2010 version this weekend!

Cheers

New version is out, i’ve used it in max 2010 32bit, and it works great

Woohoo :slight_smile: