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.

Model and Texture a Photorealistic USB Cable with Maya and Mental Ray – Day 2
Jul 22nd in 3D Art, Adobe Photoshop, Autodesk Maya, Mental Ray, Rendering, Shaders by Alan MonroigThis tutorial is Day 2 in a series - Go to Day 1
Final Effect Preview

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.














User Comments
( ADD YOURS )vasu July 22nd
great tut
( )PhSn July 22nd
great result!
( )Cristian Pop July 22nd
Great job!
( )BHO July 22nd
Good Job.. Will Definitely be using this one..
( )Modisana July 22nd
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

( )Emin July 22nd
Wow, i have to try this thx…
( )BISMARCK July 22nd
Really! we need more maya tuts, yeah!!!!
( )Deer Workshop July 22nd
Man I think I love U! jajaja lo, This one worked like a charm 2! thanks a lot!
( )Alan Monroig July 22nd
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!!!*
( )Deer Workshop July 23rd
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!
Diego SA July 22nd
100% of realism! Dude, it’s awesome!
( )Rafael Guerra July 23rd
sorry for the off topic…but man you got a pretty cool site!
( )bom trabalho…
Fidget July 23rd
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
( )Alan Monroig July 24th
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!!!
( )Fidget July 24th
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.
Tom Newbold July 23rd
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!
( )arlington cruz July 28th
yes more more Maya Tuts please. Thank you for all your help and effort into sharing all these tuts with us.
( )Danny August 29th
The final result is not very realistic, you need to work out a little. The rest is ok.
( )Rully August 30th
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
Vee September 22nd
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!
( )rully September 27th
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
( )sandeep October 2nd
ur work is excellent and very useful to all. thanks
( )Rajath October 7th
great tut. Fine detail. And absolutely great illustration. Thanks. Where can i find more of your work?
( )Kully November 7th
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!
( )Alan Monroig November 7th
There is not such thing as 3D bump, you need to select standard bump and then add a 3D textures inside that bump.
( )ctbram November 17th
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
( )ctbram November 17th
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.?
( )ctbram November 17th
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
ctbram November 17th
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
( )ctbram November 17th
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
( )ctbram November 18th
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.
Alan Monroig November 28th
Slow down! If you want help send me an email to alanmonroigcompany at yahoo dot com
elcarlio December 10th
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
( )