Tutorial Details
- Program: Maya, Mental Ray
- Difficulty: Intermediate
- Completion Time: 1-2 hours
In this tutorial you will go through the process of modeling and rendering a Photorealistic USB cable in Autodesk Maya. You will also learn to use Mental Ray, along with the new architectural materials, rendering layers, and Photoshop, to create a fast, accurate, and photorealistic depth of field.
This tutorial is Day 2 in a series – Go to Day 1
Step 1
This is where we left off at the end of Day 1.

Step 2
Go to “Window > Rendering Editors > Hypershade”.

Step 3
Go to “Window > Settings/Preferences > Plug-in Manager”, and locate “Mayatomr.mll”. Check off both “Loaded”, and “Auto Load” (do this step only if mental ray is not already loaded).

Step 4
With the “Hypershade” window open, change the type of nodes from Maya to Mental Ray, and create a new “mia_material_x”

Step 5
Go to the attribute editor for the new material, name the material, and adjust the attributes as shown.

Step 6
Scroll down to the “Bump” selection, click on the little check board square at the right of “Standard Bump” (this will open a new window). Now scroll to the “3D Textures”, and select “Rock”.

Step 7
With the “Bump” attribute editor open, change the “Bump Depth” to ’0.062′, and click on the door at the right of “Bump Value”.

Step 8
Change “Color 1” to a white grey.

Step 9
In the “Hypershade” editor, create 3 “mia_material_x” materials.

Step 10
Open the attribute editor of one of those materials, name it “mia_cable”, and adjust the attributes as shown.

Step 11
Scroll down to the bump section, click on the check board square next to “Overall bump” (this will open a new window), scroll down to 3D textures and select “Brownian”.

Step 12
With the “Bump” attribute editor opened, change “Bump Depth” to “0.372″, and click on the little door next to “Bump Value”.

Step 13
Name the texture “brownian_cable” and modify the settings as shown.

Step 14
Open the attribute editor for another one of the “mia_material_x” materials, name the material “mia_MetalConnector”, and adjust the attributes as shown.

Step 15
Don´t forget to check the “Metal Material” option, at the bottom of the “Reflection” section.

Step 16
Scroll down, open the “Anisotropy” section, and change the “Anisotropy” value to “0.100″.

Step 17
Open the last “mia_material_x” material, name it “mia_whitePlastic”, and adjust the attributes as shown.

Step 18
Now assign every material to corresponding polygons in the scene. This is how it should look.

Step 19
Select the white box inside of the metal connector, and go to “Window > UV Texture Editor”.

Step 20
Go to “Create UV´s > Planar Mapping”.

Step 21
With the top view active, scale the mapping so it only covers the 2 holes on the metal connector.

Step 22
With the “UV Texture Editor” open, go to “Polygons > UV Snapshot” (this will open a new window).

Step 23
Modify the settings as shown.

Step 24
Open up the UV snapshot file you just saved in Photoshop.

Step 25
Make a White layer.

Step 26
Add some dirt to the image and save it out.

Step 27
Open the attribute editor for the white material, click on the little check board square next to color, and in the new window, click on “File”.

Step 28
Select the image you made with Photoshop, and change the “Filter Type” to off.

Step 29
Go to “Create > Lights > Area Light”, and create 2 lights.

Step 30
Position the lights as shown.

Step 31
Open the light attribute editor and change the “Intensity” to “0.744″.

Step 32
Scroll down to the “Shadows” section, check the “Use Ray Trace Shadows” option, and change “Shadow Rays” to “30″.

Step 33
Make the same adjustments for the other light.

Step 34
Go to “Create > Cameras > Camera”.

Step 35
In the little menu on top of the perspective view, go to “Panels > Perspective > Camera”.

Step 36
Move the camera to a good position.

Step 37
Open the “Rendering Settings”, and change “Render Using” to “Mental Ray”.

Step 38
Go to the “Quality” tab, and adjust the settings as shown.

Step 39
Go to the “Indirect Lighting” tab and activate “Final Gathering”.

Step 40
Go to the “Common” tab, change “Renderable camera” to your main camera, and the image size to “720P”.

Step 41
Now render the scene. As you can see, we are only missing the depth of field.

Step 42
Go to the “Rendering” layers editor, create a new layer named “Depth of Field”, and add all the objects in the scene to it.

Step 43
With the new render layer selected, go to the camera attributes, scroll down to “Depth of Field”, right click the option, and select “Create Layer Override” (the words should change to orange).

Step 44
Adjust the settings of the depth of field as shown.

Step 45
Go to the “Depth of Field Tab”, click on “Presets”, and select “Luminance” map (everything should turn black).

Step 46
This is how the scene should look.

Step 47
Render the layer. Now we have depth of field information for Photoshop.

Step 48
In the “Render View” menu, go to “File > Save Image” and save the image.

Step 49
Now render the master layer, and save the image.

Step 50
Open Photoshop, make 2 layers (1 with the USB, and the other with the depth of field information). Select the depth of field layer and copy it.

Step 51
With the “Channels” tab active, create a new channel, and go to “Edit > Paste”.

Step 52
Hide the depth of field layer, and select the USB layer.

Step 53
Go to “Filter > Blur > Lens Blur” (this will open a new window).

Step 54
Change the source to “Alpha 1”, and adjust the other settings to match you preferences. Click on OK.

Final Result
Now save the image and you are done!!!

Start at the beginning – Go to Day 1
Don’t miss more CG tutorials and guides, published daily – subscribe to Cgtuts+ by RSS.



HDRi - 1735 Clear Sky only $25.00 
great tut
great result!
Great job!
Good Job.. Will Definitely be using this one..
Incredible…Will definitely give this one a go since Im learning Maya….
Pity we don’t have that many Maya tutorials on CG Tuts, Hopefully that’ll change soon.
Thanks
Wow, i have to try this thx…
Really! we need more maya tuts, yeah!!!!
Man I think I love U! jajaja lo, This one worked like a charm 2! thanks a lot!
This is the final work you did with my tutorial??? http://deerworkshop.deviantart.com/art/USB-final-render-130475440
Nice I like it, (you could position the light more on top of the USB and your shadows won´t be so large)
*Great job!!!*
OH! thanks man! LOL I really appreciate that one! Sure, I’ll be practicing a lot more!, By the way, could U please show us how to put textures on Maya and Mental Ray?, like wood textures or something, it’s just that for the USB I wanted to make the “floor” made od wood like if the USB was over a table, but I don’t know how 2 do that :’(, so I don’t know if U can help me on that, I don’t know if I have to do some UV mapping or creating a material :S, so anyways, Thank U a lot! That USB I made maight not be the greatest but I’ll keep practicing a lot! Greetings!
100% of realism! Dude, it’s awesome!
sorry for the off topic…but man you got a pretty cool site!
bom trabalho…
Thanks for the cool tutorial. It helped me out much in the modeling dept.
Are there any other ways to create wires? I remember seeing one created in a similar fashion, but different. But I do not remember exactly how.
Here is my result. Thanks again.
http://www.sinewavezero.com/cgtut1.html
I love the reflective floor and the metal bars Great idea…
I don´t know any other way to make a wire, make a Google search
Nice work!!!
thanks, I had to put the metal bars there because when I was done the plug was somehow floating above the surface.
so I needed something for it to rest on.
I remembered the alternate way to make wires. for those interested here it is.
1) create a path with the CV Curve tool
2) create a nurbs circle
3) rotate the nurbs circle upright
4) select the nurbs circle then select the CV Curve path
5) go to surfaces> extrude
6) in the extrude menu make sure “tube” is selected and make sure “at path” is selected and hit apply
I hope this helps too.
thanks again for the tutorial.
Nice tut! need more maya tuts like this imo! I struggled a little with the planor mapping and uv texture editor for the dirt on the white part.. Ill post link when ive finished
MORE MAYA TUTS!
yes more more Maya Tuts please. Thank you for all your help and effort into sharing all these tuts with us.
The final result is not very realistic, you need to work out a little. The rest is ok.
alan, I follow this tutorial step by step but in finalize the result different with your result picture.my metal connector is not like metal please send me step by step detail, because i am beginner in maya.
Thanks
Both parts of this have helped a LOT! Seeing your work flow was of great assistance.
I didn’t quite get the lighting to work out the same way, but I’ll keep tweaking.
Thank you for posting these!
anybody, may i have your final working file (mb) file to compare the result with my. because my result not like your picture.
please send to my email at lirusme@gmail.com
thanks
ur work is excellent and very useful to all. thanks
great tut. Fine detail. And absolutely great illustration. Thanks. Where can i find more of your work?
hey sup dudes, great tut, i am having trouble with the mia_material for the first part, when i go to the attribute editor i dont seem to have a 3d bump there, please help!
There is not such thing as 3D bump, you need to select standard bump and then add a 3D textures inside that bump.
Not sure why my comments are not showing up and apologize if this ends up being a repost.
Here is the result of my first render after assigning the materials and setting up the area lights.
It does not really match the results in the tutorial and I would really like to know what I am doing wrong. The metallic connector is the main problem as it does not look metallic to me. I rechecked all the settings several times and even recreated the material from scratch.
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_001.jpg
I also had to reduce the bump and grain size on the black plastic parts.
The Brownian bump on the cable matches the tutorial settings but also does not match.
Sure would like to know what I am doing wrong.
I really hate texturing in Maya! No one ever explains why they use the settings they use. Why not just have presets for various common materials like chrome, aluminum, etc.?
Here are some renders at with different lens lengths (28mm, 70mm, 135mm) at 720 HD and 640×480 res. I like the 135mm @ 720 HD.
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_135mm.jpg
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_28mm.jpg
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_70mm.jpg
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_001.jpg
Since I can’t figure out why the renders are not matching I decided to add a usb logo detail to the top of the connector using an adobe illustrator object.
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_135mm_001.jpg
I can’t edit comments and I changed the last link so here is the new one…
http://i181.photobucket.com/albums/x185/ctbram/usb_cable_cgtut/usbConnector_cgTut_135mm_002.jpg
There are a couple annoying omissions and apparent mistakes
1. If you set the file filter to “OFF” then no image appears in the render for the texturing of the dirt map on the white plastic insert.
2. The method of taking a planer uv map of the section where the two holes are causes a problem with u and v wrapping on. If you turn u and v wrapping off then the front of the white plastic insert turns gray.
3. There is something funky with the mia_material_x settings for the metal connector. I have spent an entire day tweaking the lights and the settings and putting objects in the scene and trying reflection panels and I cannot get the connector to look metallic.
4. It was much easier to simply extrude a face from the end of a cylinder along the curve to create the cable. The authors method is extremely convoluted using an animation flow path.
Slow down! If you want help send me an email to alanmonroigcompany at yahoo dot com
Great Tut, but ive got one problem, cant find the depth of field tab to get the luminance preset in my camera after activating the orange DoF.
Thanks
Thank you so much! awsome tutorial, easy to follow and easy to understand.
I did this tutorial, line for line, twice and am getting a lot of the issues other people have gotten.
1. The metal connector surface is not coming out right. Like others, it’s just gray, not shiny (and I triple checked it).
2. The UV texture on the dirt isn’t coming through (not sure if it’s even working).
3. The method to make the cord is overly complicated (there’s easier ways)
4. I get no Depth of Field tab when I enable DOF and right-click it to the layer override (using Maya 2009). This whole part of the tutorial doesn’t work. It does however process the DOF right in the render, which looks bad.
Here’s my image:
Overall though it’s a good modeling tutorial. Like most of non-video tutorials on here, it leaves steps out or doesn’t explain everything you need to do.
http://i77.photobucket.com/albums/j44/evolross/usb_cord_v01.jpg
done in Modo
http://www.blue-coyote.com/usbfinal.jpg
well i’m very very new to making things in maya but i think mine came out pretty good
http://nimil-3d.deviantart.com/art/a-simple-usb-plug-159510318
thank you for this tutorial. a couple of steps were a little hard to figure out but thankfully google was there for the parts i couldn’t find on my own :p
there is a tip that works fine with me for the metal connector take the texture of metal.. go to window /rendering editors /hypershade take open the mia_MetalConnector and in the atribute editor in the top, in the part where you can change the name of the material, you can see to the right the presets* button. ok so you only press the button presets /crhome / replace and that’s it, you will have the texture of metal
hi
amazing tutorial. i’m working in an arch firm as a graphic designer and doing 3d proposals. however, i saw this image and it was so realistic so i wanted to give it a try as its not using ibl as well! but i didn’t get the same the quality! im losing details on the plastic and not getting the amazing look that you had on the metal!
this is my try: http://yfrog.com/5zusbsamplej
and please do u have any tutorials for using mental ray for exterior rendering! im using hte sun/sky or ibl but im always missing something! i want it to be so realistic as i will place the building on an actual picture. anyone who can help ill be really appreciated
im a 13 year old graphic modeler from Pakistan and i find ur tutorial very easy to follow. i got confused in the photoshop section as i havent used photoshop before but i got it right in the end. Great Tutorial!
im a 24 year old 3d modeler from india and i find ur tutorial very easy to follow. i got confused in the animation section . plz add any tutorial walk cycle in maya .and thanks Great Tutorial!
very well done, perfect. thx.
wow! good tutorial and good work!
thanks!
Very nice tutorial!
>:( nothing worked from 43 until the end
Hi.having a lot of problems while smoothing. Please reply on my email ID so that I can write everything in detail
Great tutorial, really got me thinking about getting the best results.