Now let's import the car and add some shaders to it.
If you are starting the tutorial here you can download the results of the previous section below.
- Download the minibrick roadster model from above. Add it to the scene by entering the preview_domes node and amend the file node to point to the car instead. Rename the file node to roadster_built. The material node will show an error but just delete it as it is no longer required.
- At Object level rename the node to roadster_built and apply the diffuse_dome shader under the Material tab. Under the Transform tab, Rotate it by 145° in Y and do a test render.
Rather than create a separate shader for each color of the car, we will only create two shaders and use attributes and user data to color them correctly.
Enter the roadster_built geometry node and add an Attribute Create node after the File node. Clicking the down arrow next to the Group parameter shows all of the individual bits that make up the model.
Each of the pieces in the .obj file have been given a color shorthand in their name. dargry = dark grey, whi = white, bge = beige and so on. This can be used to assign the new color attribute to only the right bits of geometry. For example, entering *_dargry_* as the Group name will assign it to any dark gray piece.
- Change the attribute Name to Cd, which is a built in attribute for Color Data. Change the Type to Vector as three values will be needed for R, G and B. As this is dark gray, set the Value to 0.25, 0.25, 0.25.
- Repeat this process for the colors listed below.
|Dark Grey||*_dargry_*||0.25, 0.25. 0.25|
|Dark Blue||*_darblu_*||0, 0.2, 0.9|
|Red||*_red_*||0.9, 0, 0|
|Yellow||*_yel_*||0.9, 0.7, 0|
|Orange||*_ora_*||1, 0.6, 0|
|Beige||*_bge_*||1, 0.885, 0.502|
|Light Blue||*_ligblu_*||0.2, 0.5, 1|
|White||*_whi_*||0.8, 0.8, 1|
|Grey||*_gry_*||0.5, 0.5, 0.5|
|Black||*_blk_*||0.05, 0.05, 0.05|
- The colors will be visible in the viewport.
- The attribute Cd needs to be exported to the .ass file as user data where it can be picked up by the shader we are going to create. Go to the Arnold Properties of the minibrick car and click on the Attributes tab. Enter Cd as a Point Attribute.
- Go the SHOP and tab-create an Arnold Shader Network called opaque_plastic. Enter this and tab-create a Standard Surface shader. Connect the RGB output of standard1 to the surface input of OUT_material. create a User Data RGB node and connect it to the Base Color parameter.
- To give the plastic a bit of sheen, go to the Specular tab and change the Specular amount to 0.15 and lower the Roughess to 0.25.
- To assign the color we need to pick up the Cd attribute and pass it to the shader. Select the user_data_rgb1 node and in Attribute put Cd.
- To assign the shader drag opaque_plastic onto the car geometry and select Paste Material Shader Shop or assign it under the car's material tab.
- Render the scene to see what the shaded car looks like.
We will need to create another shader for the transparent plastic but first, the car pieces must be separated into opaque and non-opaque groups so that the right Arnold properties can be applied.
- Return to object level and rename the roadster_built node to roadster_built_solid. Enter inside and after all the attributes create a Delete node.
As well as tags to apply shaders, the geometry also has tags to differentiate between clear and solid. Select the delete node and enter *_clr_* as the Group. This will delete all the clear pieces such as the windscreen and lights.
- At object level, create a new geometry node and call it roadster_build_clear. Inside, delete the file node and create an Object Merge node instead. In Object 1 put the path to the car file node, /obj/roadster_built_opaque/roadster_built. As we only want the clear parts this time, put *_clr_* in Group 1.
- Again, we need to add some color attributes to the geo. Copy the red, orange and white createAttr nodes from the opaque car and paste them below the object_merge1. Modify the White so that the values are 1, 1, 1.
- We need to tell Arnold that these pieces are not opaque to treat them as transparent. Add Arnold properties to the roadster_build_clear node and go the Arnold > Visibilty tab. Disable Opaque.
- Like before, add Subdivisions to smooth the geometry and add the Cd point attribute to Properties.
- Copy the opaque_plastic shader network and rename it to clear_plastic. Also, attach the user_data_rgb1 node to Transmission Color.
- Under the Base tab, set Weight to 0.1.
- Under the Specular tab, set both Specular and Roughness to 0.15.
- Under the Transmission tab, set Weight to 0.95. Set the Index of Refraction to 1.15.
- Render the scene.