Notifications
Clear all

[Closed] extracting bitmaps from promaterials using maxscript

Hello all,

 I've been working with revit scenes for a while now, which uses Promaterials. While this is nice if you want to make quick renders inside of 3dsmax, it doesn't leave much room for other (realtime) products, since they don't support Promaterials. 
 
 After some googling, I found a script on the forums here that takes all materials in the scene, converts them to standard materials, and transfers just the diffuse channel (aka bitmap). But that script was made in 2008 and I believe that was before they started using Autodesk bitmaps as bitmap handlers, instead of the standard bitmap map that 3dsmax uses. 
 
 This is a problem because the script can't recognise the bitmap handler which is nestled in the Promaterial, so it basically turns all your materials in gray standard ones, which is not that handy. :)

Here is the script:


  (
  -- Replace 'Architectural' with whichever class you want to convert
  local ArchMats = getClassInstances Autodesk_Material
  
  -- Locals
  local StandardMat, Props, Prop
  
  -- Iterate through all material instances
  for ArchMat in ArchMats do
  (
  -- Create a standard material
  StandardMat = standardMaterial name:(ArchMat.name + "_Converted")
  
  -- Collect property names of the original material
  Props = getPropNames ArchMat
  
  -- Iterate through property names
  for Prop in Props where isProperty StandardMat Prop do
  (
  try
  (
  -- Try to set the property on the standard material
  setProperty StandardMat Prop (getProperty ArchMat Prop)
  )
  catch
  (
  format "Cannot set property % : \"%\".
" Prop (getCurrentException())
  )
  )
  
  -- Replace the original material with the new standard material
  replaceInstances ArchMat StandardMat
  )
  )
  

If someone were to be able to help me in any way possible, that would be awesome.

PS: I have basically zero knowledge of maxscript, but I know how to read it slightly, so don’t expect too much…

PPS: it would also help a whole bunch if the script could copy over the diffuse colour, since not every material has a bitmap.

6 Replies

This is the only one I’ve found that mostly works with promaterials.

http://www.scriptspot.com/3ds-max/scripts/multyconvertor

That doesn’t seem to work with my revit imports:

It doesn’t replace anything. Are there any special links i should make?

hi

shader utilities have a cleaner to remove the autodesk_bitmap_shader from Pro-Materials. Or you can use the Optionlist to set the Diffuse_Fade_Value to zero.

cleaner: http://www.infinity-vision.de/page/su_documentation#cleaner

optionlist: http://www.infinity-vision.de/page/su_documentation#ol look at the last option!

mfg
hot chip

1 Reply
(@anvile)
Joined: 10 months ago

Posts: 0

And that allows me to replace it automatically with a normal bitmap?

No, it remove only the bitmap_shader. But when you don´t wan´t lost the bitmap_shader, can you use at the optionlist “diffuse fade value” and set this to zero for all Materials.

mfg
hot chip

1 Reply
(@anvile)
Joined: 10 months ago

Posts: 0

Hmm, thanks, but that’s not what i need. I don’t need to remove them, but copy the bitmap over and use it in a standard material, preferably with the same tiling.