Carpaint Material with Object Color Option

Example and Explanation by Zaug

Download the project file


W³ ?

This explanation describes the steps to add an option to the default Car Paint material so it can use the object's color property set in the "Col" tab of the select window. The steps here easily transfer to other materials that have their colors set internally.

This documentation assumes, at least, a basic working knowledge of Realsoft3D; how to create and alter the properties of basic geometric and VSL material objects.





Just a Few Simple Additions...





Begin by selecting the car paint material and selecting "Duplicate" from the right-click select window menu; name the copy something appropriate like "Car Paint-object color". Open the properties window and activate the Advanced Tab.


Duplicating the VSL object: Select the multiply operation item, "Color = multiply(rn, basecol)"

Select "Duplicate" from the right-click menu. Drag this duplicate object so it is above it's twin.


This VSL operator takes the value of the variable "rn"(carrying the value of ray hit calculations) and multiplies it times the value of the variable "basecol".








Changing the Channel: Select the copy of the VSL object. Select the "In/Out" tab in the properties area below the VSL hiearchy.

Click on "Input 1" and select "Surface: Color" from the channels list at the right. Now, the copy of the VSL operator uses the color of the object as it's second input. Applying the material and rendering shows that something is still missing; the original operator is being evaluated after the copy, thus any operation performed by the copy is overwritten by the original. They both are outputting to the "Color" channel. To make the effect of the altered operator visible, the original operator needs to be disabled. This can be done by checking the "Disable" checkbox in the advanced VSL properties. But a more convenient option would be to make the behavior settable in the standard (with "Advanced" un-checked) VSL properties window.








Making it an Option: Click on the "Attributes" tab (the middle tab of the main VSL window). Scroll down in the "Attributes" list and select the item "Color=multiplication(rn, basecol) Disabled". This attribute item corresponds to the "Disable" checkbox for the origianl VSL operator. Click on the "Show" button; this makes the option visible in the standard VSL interface. Change the default "Name" of the option to something more indicative of it's purpose and add a "Tool tip" with a more detailed explanation.







The Results: Click on the "Shaders" VSL window tab and un-check "Advanced". The new checkbox should be there ready to test. The lack of the "Base Color" in the material preview should be apparent. The "denim" preview is being used in this image. Un-checking the option restores the original behavior of the material.


Summary: The original VSL multiplication operator that output to the color channel was duplicated and it's input changed to instead use the color property of the object. The original operator was left below so it would be evaluated after the copy. To toggle the behavior, the "Disabled" attribute for the original operator was made visible in the standard interface and re-labled.

To make this same type of modification to other materials that have color attributes defined internally, simply look through the material for the last occurence of an operator outputting to the "Color" channel and try the steps listed here.

Only work on copies of the materials!