Notifications
Clear all

[Closed] Turn Off 'Premultiplied Alpha' on everything?

can I turn off the ‘Premultiplied Alpha’ setting for all Bitmap slots in my materials?

here’s my listener read out when I do it manually:

meditMaterials[1].materialList[26][#Maps][#Diffuse_Color__env_piazza_brick_dm__env_piazza_brick_dm_tga].preMultAlpha = off

how could I apply this to all my Materials?

thanks!

10 Replies

certainly you can… the question is what are your all materials?

Some are multi-sub-objects (upto 95 ids) with bitmaps applied to Diffuse

others are Standard Materials with bitmaps applied to Diffuse

These materials are not named with a convention, some are ‘Building_Materials’ others are ‘asdf’ or ‘08-Default’

I was hoping maybe, for something like: for all Bitmap textures Premultiplied Alpha = 0 (haha, I dont know much scripting)

edit: None of these materials are using an Alpha Channel for transparency

why am i asking? the preMultAlpha is bitmaptexture’s property. we can get all bitmaptextures from the scene using getClassInstances method, and change the property. but is it really what you want to get?

When a bitmap is applied to a material slot, the default is to apply the alpha channel (if available) as Premultiplied. This makes my material render much lighter than the texture really looks, I always turn off Premultiplied when I add bitmaps. But I’m now given a file with 100 or more materials all set to Premultiplied so the renders look washed out.

I have a work around, but yes, I’d like to turn Premultiplied off for all used bitmaps.

I dont understand the getClassInstances method – I’ll look into it – thanks

 lo1
for m in (getclassInstances bitmapTex) do m.preMultAlpha = off
1 Reply
(@gravey)
Joined: 11 months ago

Posts: 0

alternative, slightly shorter and theoretically faster version since it’s just 1 property changing:

(getClassInstances bitmaptex).preMultAlpha = off

whether it is actually faster or not, it’s probably too close to tell so it’s a matter of preference

This getClassInstances “thing” seems great! Never thought of this before. Thanks!

Everyone thanks so much – totally blown away by how one line of code can save so much time – you’re brilliant!

 PEN

My quess is the shorter one is faster as it is using as it is using C++ to do the loop instead of Max Script. You would probably need to loop trough a 100 scene to be able to see the difference.

You mean compile a .dll using C++ accessing the core functions?