Thursday, May 3, 2012

Extending render pass availability of mi_car_paint_phen_x_passes








The mi_car_paint_phen_x_passes provides with the following render passes by default.

ambientRaw
diffuse
directIrradiance
reflection
specular
indirect

However, if you utilized the custom color pass, you can render out the following passes as well.

Ambient, Spec1, Spec2, Flake, Flake Reflection, Dirt.

I like using the bent normal method for a simulated indirect illumination. (This is introduced in this post.)
This method is easily available for mi_car_paint_phen_x_passes because it has the Ambient color slot.

And I also like to use a mia_material for the car paint's reflection, since it gives me a better control and quality especially when coupled with the mia_envBlur.

So the question comes down to whether I can get all the necessary render passes after setting up the shader.

The render passes that I need is like below.

Ambient ( for the simulated indirect illumination through bent normal )
Diffuse
Reflection ( mia material's )
Specular ( car paint's )

MasterBeauty

Here's the MasterBeauty of the test render. The left sphere is the mi_car_paint_phen_x_passes shader only and the right sphere is the mi_car_paint_phen_x_passes and mia material combo.

I simply connected the output to the additional color attribute of the mia material.

The render passes are below.

ambientRaw

diffuse



specular 
I turned off the specular of the mia_material by setting the Specular Balance to zero. So what shows up on the right one is the specular of the mi_car_paint_phen_x_pass shader.

reflection
I turned off the reflection of the mi_car_paint_phen_x_passes shader by setting the Reflection Color to black. So only the right one shows the reflection which comes from the mia material.


The problem with the default Render pass is that the ambientRaw pass is a raw color not a processed color. This means it's just the pure bent normal output which is a simulated indirect illumination color itself. So I need a pure diffuseMaterialColor pass to multiply it with the ambientRaw pass to generate a processed pass.

I created a new render pass, Custom Color. And I named it "AmbientCarPaint".
Then I created a WriteToColorBuffer node and set it up like below. Note that ambientCarPaint pass is selected for the Custom Color Pass.


 This is the shader connection. Notice that a new writeToColorBuffer node is created and connected.





The below is the connection between the mi_car_paint_phen_x_passes shader and the writeToColorBuffer node.


By default, mi_car_paint_phen_x_passes doesn't support the diffuseMaterialColor pass. But instead,
AmbientLevel produces the same result. Now it will be output through the custom buffer.

ambientLevel

The reason why it doesn't look flat like a regular diffuseMaterialColor pass is that mi_car_paint_phen_x_passes shader has a unique attribute "Edge Color Bias" that makes the diffuse color darker around the edge just like the Fresnel effect.

Now that I have all the necessary passes, here's the comp in Nuke.

The comp result is identical to the first MasterBeauty render. So, this car paint shader is ready to go!






No comments:

Post a Comment