Friday, February 3, 2012

MaterialByElement in Blender - EN

Hi guys,
in my Blender work I needed something similar to "Material by Element" in 3DMax.
So, after having a look around, I've decided to make it on my own:



And this is a small preview of the script applied to rooftiles:




The script at the moment does the following task:
(tested on Blender 2.61 on Win64)

1 - it removes ALL materials from scene
2 - it creates 'N' materials whose diffuse is calculated so:
  • (r+(i/K), g+(i/K), b+(i/K))   for i even
  • (r-(i/K), g-(i/K), b-(i/K))     for i odd
dove:
  • i is the for counter (range: 0-N)
  • r, g, b are the main color's values
  • K is the number that make the difference between diffuses (N*5 = more contrast, N*20 = less)
3 - it assigns the each material to one or more objects in the scene, until the end of selection


FAQ:
  1. Why does it removes ALL material? Because in developing stage I need a clean scene.
  2. How do you use it? At the moment I use a separate .blend file for rooftile and I keep'em linked to the main scene.
  3. How does it works? Simply copy and paste the code in the editor and run it.
  4. Something more? Yeah. Make a BACKUP of your work and be sure that you've ALL objects selected :)

I've got to go ahead, see you!

No comments:

Post a Comment