Creating a random shaded look for repeating items - techniques?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  01 January 2013
Question Creating a random shaded look for repeating items - techniques?

I am learning UV texturing/shading. I modeled a quick elevator in about 2 days and I want to shade it using Maya 2013. Right now, it has flat shaders and a few procedural shaders that look really bad.

I'd like to get some grunge and metal photos and create a more realistic scene. I'm learning the whole UV shading process, and I like it. But I don't want every repeating piece of geometry to look identical to the last. I'd like them to be more random.

Are there good practices for accomplishing this? Perhaps combining different mappings for color, specular, and reflective properties to create variety?

  01 January 2013
If they're static, 1 way is to utilize the 3d procedural texture nodes. It can be used as a mask to blend in a second texture (such as rust) on top of your base material. Or simply lay on top to create color or value variety.
  01 January 2013
you can also add an attribute to each object, assign a random value between 0 and 1 then pipe this through a switch that calls the v value from a ramp, which can then in turn drive diffuse, reflect, procedural textures and pretty much anything else. With a pretty simple script you can use this to randomize across many objects with only one shader.


  01 January 2013
Craig (skunk),

Are there examples of this anywhere? I have, literally, never scripted in Maya.
  01 January 2013
you only really need to script the randomizing of values on your custom attributes.

the MEL code below will add an attribute if it does'nt exit otherwise it will just random the values between the min and max threshold.

copy and paste the code into your script editor.
ctrl + a .. to select text.
ctrl + enter execute text.
EDIT.. select the objects you want to add attributes to before you execute ...END EDIT

you only need to edit the 3 variables at the top of the code.
change "myattr" to "anything you like" (this will be your attribute name). Also you can change the $min and $max values ( your random number will be generated between this range).


string  $attribute = "myattr"; // your attribute name here
float $min = 0.8; // your min vslur
float $max = 1; //your max value    
string $sel[] = `ls -sl`;

    if(! `attributeExists $attribute $sel[$i]`) // check if the attribute already exists
        addAttr -ln $attribute -at double  $sel[$i];  //add attribute
        setAttr -e-keyable true ($sel[$i] + "." + $attribute); 
        float $rand = rand($min,$max);     //randomize
        setAttr ($sel[$i] + "." + $attribute) $rand; //set attribute value
        float $rand = rand($min,$max);     //randomize
        setAttr ($sel[$i] + "." + $attribute) $rand; //set attribute value

Last edited by skunk184 : 01 January 2013 at 07:21 AM.
  01 January 2013
This is fascinating. Thanks for posting. I'll be studying this script to see how and why it does its magic.

  01 January 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 05:55 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.