🧩Creating a secondary color
How it works
The CrystalCoat feature allows to define a primary color that shall cover the painted areas of the vehicle and then a secondary color that goes on top of the primary color.
The idea of the secondary color is to create shapes, patterns or to cover only some parts of the vehicle. There are two approaches that you can combine as you wish in order to create a secondary color.
Approach #1: color whole parts
The most simple way is to apply the secondary color on a complete mesh so the combination of multiple components will give a nice result. This can work especially with vehicles that use a organic design such as Rayfield vehicles.
If a component subset could make sense to use the secondary color then you can submesh it and apply this approach with it.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252F4zuR5S4jKhWgKAiJGRig%252Fimage.png%3Falt%3Dmedia%26token%3Ddbc9fbef-e9ef-4740-905f-ebd204b2ba48&width=768&dpr=4&quality=100&sign=9ee96e15&sv=1)
On this picture, the silver front wings of the vehicle have been submeshed to they can be colored entirely without affecting the rest of the body part.
With conventional vehicles that consist in a box with 4 square doors, this approach won't give a nice result most of the time. Except for wheels.
Approach #2: use a mask
The approach that allows the most possibilities is to work with a UV layout.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FfYTea5ZnN2MEkbJy4BoU%252Fpainted.png%3Falt%3Dmedia%26token%3Daf679fcc-1eaf-48b5-85c1-e3f5f081305f&width=768&dpr=4&quality=100&sign=736bd818&sv=1)
What is a UV layout
When you want to apply a 2D resource onto a 3D model you need to project your mesh onto a plane. Think of it as a spotlight that projects the shadow of an object on the ground. Although this is not exactly what is happening.
The mesh is made of vertices so you simply decide where you want to place these vertices on the plane. The classic way to use this technic looks a bit like a spotlight projection as you can see on the picture above. It also makes it easier for a human to understand what is going on.
This type of projection is particularly useful if you want to apply 2D resources across multiple parts at once. In the case of CrystalCoat you may want to create oblique stripes across the body, roof and doors of the vehicle. You can do it easily with the Mahir Supron.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FCpc7bleutbfmM0WUj7BX%252Fpainted1.png%3Falt%3Dmedia%26token%3Df03773e9-4f1b-40d2-ac1d-bffd64932f05&width=768&dpr=4&quality=100&sign=2984dc74&sv=1)
The red stripes on this picture would not necessarily be red but they represent shapes that you can create to define a secondary color pattern.
The easiest way to create such mask is to use a image editor like Adobe Photoshop to create shapes and to transform them (rotate, shear, scale, translate) onto the UV layout of the component.
Most of the time the components of a vehicle are sharing the same UV layout that is to say they are all sharing the UV space without overlapping each other. In this case they use the same mlmask file in their material definition.
You will notice that wheels are always using a dedicated UV layout so you won't be able to use the same InkWidget to apply a secondary color for both the painted areas of the vehicle and for its wheels.
What if the UV layout is different between parts
In the case your vehicle uses a different UV layout for each component it becomes more difficult to define shapes that will apply across multiple parts.
And moreover when the UV layout is different you always need to use a new InkWidget because your patterns are bound to a specific UV layout. The red stripes on the picture above make sense only for this unique UV layout. Any other one wouldn't suit.
Another way to use the UV layout
There is a third way to create a secondary color pattern. It is the same idea as to create a mask but instead of editing a picture into a image editor you can create shapes directly into the InkWidget file. This is what is being done for the Rayfield vehicles in the base game.
The InkWidget file for the Rayfield Caliburn contains 16 shapes for the secondary color pattern.
This way of creating shapes is the most difficult because you can't even work with a UV layout to know what you are doing. You must try and test multiple times until the shapes are applying correctly on the vehicle. Also there is no benefit to use this approach.
I recommend you to work on a mask using a image editor.
Create a clean UV layout
You could use the mlmask file from the game and extract the mask layer corresponding to the vehicle paint. But you will notice that masks from the base game are quite messy and even contain imperfections. Also if the paint layer is the layer 0 then you won't be able to use this technic.
In order to create a clean UV layout for your secondary color pattern, you should create your own mask using the mesh files. Export all the mesh files involved in the vehicle paint using the menu Tools > Export Tool
.
In the case of the Mahir Supron I will export all the _painted
files except the wheel one. Then I will also export the roof mesh file. Import them all into Blender and uncheck the With Materials
option so the import will be faster.
You can only import mesh components that are sharing the same UV layout together. That is to say they use the same mlmask file. Otherwise they may overlap on one another.
Select all the meshes using the A
key then press TAB
to go into Edit mode
. Finally select the UV Editing
view in the menu bar.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FYRCRXgKC9hQeaTpaghv0%252Fimage.png%3Falt%3Dmedia%26token%3D5c757a65-581a-4d6c-8ff1-c8226249b5cb&width=768&dpr=4&quality=100&sign=e026c2dd&sv=1)
You can see on the left that your UV layout has been generated. Export it to PNG using the menu UV > Export UV Layout
. Define the size to 1024x1024 and set the Fill Opacity
to 1.00.
Open Adobe Photoshop or another image editor and create a new project with a image size of 1024x1024. Then fill it with black color by using the menu Edit > Fill
. Import the PNG file you have just created with Blender. It should be imported into a new layer.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FyL8YoqaCy9MMo6eOrsWW%252Fimage.png%3Falt%3Dmedia%26token%3Dff78acee-8896-4cfa-890e-2be16d4c279b&width=768&dpr=4&quality=100&sign=e4958777&sv=1)
Create a new style on the UV layout to fill it with white. Now you have created your mask for the painted areas of the vehicle.
Define your secondary color pattern
The next part is to define your secondary color pattern by adding shapes on top of your mask using dynamic objects (like the Rectangle tool) or any other technic as long as they belong to a dedicated layer. I recommend that you use red shapes so you can see them better.
Before exporting the mask we will fill them with white.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FA7OqYn0F6FvJXBGUHiD2%252Fimage.png%3Falt%3Dmedia%26token%3D432cb631-c9f2-45da-b686-dc1b19f521d0&width=768&dpr=4&quality=100&sign=8993a54c&sv=1)
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252F6U9VHVAYJ0fGzwNxysQp%252Fimage.png%3Falt%3Dmedia%26token%3D993d2d8f-4b47-4e03-bc3d-9a01bf1d5173&width=768&dpr=4&quality=100&sign=c8bb659b&sv=1)
You can also use any other tool to create shapes such as the magic wand to select color areas or other selection tools. You can even use external images, logos and even text. Once your pattern is ready create a style on it to fill it with white just like you did previously. Then hide all the other layers except the pattern so you have something like this.
Although you can use any kind of shape to define a secondary color pattern like logos and text you should keep in mind that the InkWidget resolution on the vehicle is low so you won't have a lot of details.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252Ft3wQPjCOcV8fZoBIjCAk%252Fimage.png%3Falt%3Dmedia%26token%3D0abba47f-a872-4959-809d-e59a25176788&width=768&dpr=4&quality=100&sign=bf9af384&sv=1)
Finally export the image as PNG. Now it is time to export your secondary_color.xbm
texture to PNG using the Tools > Export Tool
. Erase the PNG export with your PNG mask using the same file name.
Then use the Tools > Import Tool
with the following settings to import your mask back into the texture file.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FoX9vznbw2oZnBJDw3k0a%252Fimage.png%3Falt%3Dmedia%26token%3Dd202e246-2ca4-418a-8f5c-f48d30147bcb&width=768&dpr=4&quality=100&sign=7963b801&sv=1)
Update the WorldWidgetComponents
From the beginning of this tutorial you are using the vvc_full_primary_only.inkwidget
into all of your WorldWidgetComponents so you can only display a primary color on your components.
Now you have defined a secondary color pattern, you must use the vvc_car_appearance_widget.inkwidget
for all components except for wheels. You need to update the widgetResource
field of your WorldWidgetComponents using the relative path to this InkWidget.
Apply the secondary color on wheels inserts
The _painted
WorldWidgetComponents for wheels will still be using the vvc_full_primary_only.inkwidget
.
We want to apply the secondary color on wheels inserts too. But as the wheels are using a dedicated mlmask (UV layout) we would need to duplicate the InkWidget file, and also the secondary_color.xbm
and the secondary_color.inkatlas
files.
Then update their relative path into the new dedicated InkWidget and finally create a mask for the wheels using a image editor.
We can obtain the same result by simply using the vvc_full_primary_and_secondary.inkwidget
on the _inserts
WorldWidgetComponents of the wheels.
visual_customization_wheel_01_fl_a_inserts_custom
visual_customization_wheel_01_fr_a_inserts_custom
visual_customization_wheel_01_bl_a_inserts_custom
visual_customization_wheel_01_br_a_inserts_custom
Configure the color picker widget
At the beginning of this tutorial we have removed the ability for the user to select a secondary color. Now we are going to restore this feature.
Update the script
Remove the code you have added in this paragraph of the tutorial.
Update the color picker widget
Right-click on the vehicle_visual_customization.inkwidget
and export it into JSON. Then perform these replacements in the opposite way to restore the inner circle of the widget. Finally import the JSON file back into InkWidget.
Now let's test the mod again.
For a component to use the secondary color you must set its appearance to either Coated
or Painted
in the mod settings. Concerning wheels parts you need to set their appearances to eitherMetallic
or Glossy
in the mod settings.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FfjDlMcJP4oQge53ycr3I%252FCyberpunk%25202077%2520Screenshot%25202024.05.28%2520-%252002.13.35.37.png%3Falt%3Dmedia%26token%3D3dca7ee6-56ca-45d0-8001-963feb23f058&width=768&dpr=4&quality=100&sign=c6c558c1&sv=1)
Wait ! I don't see the secondary color pattern on the color picker !
Adding a mask to the color picker widget
Remember that the texture vehicle_visual_customization_car_preview.xbm
that contains the vehicle model into the color picker widget has a part dedicated to the secondary color.
All you have to do is to follow this paragraph to modify the secondary color mask instead of the vehicle model. The secondary color mask should be a selection of the original model. The following picture is the mask I have created. Visible parts of the model will use the secondary color if it is defined.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252F0AEsDge52qURosRKFZvX%252Fcolor_mask.png%3Falt%3Dmedia%26token%3Dbaf1a797-23ad-4b1f-b8d0-c7aa020ce741&width=768&dpr=4&quality=100&sign=1407ad2d&sv=1)
The most accurate way to create the mask is to duplicate the section that contains the vehicle model. Then keep only the areas that should be affected by the secondary color.
Your image should not be larger than 1200 pixels or the InkWidget won't display the texture parts correctly.
Concerning the secondary color pattern I have choosen for the Mahir Supron, it cannot be easily seen on the color picker. This will depend on your choices.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FUV6UK5MzepCpCwuWTCTw%252FCyberpunk%25202077%2520Screenshot%25202024.05.28%2520-%252016.05.50.72.png%3Falt%3Dmedia%26token%3D7f9fded2-5490-41be-9e6e-0387f1757a30&width=768&dpr=4&quality=100&sign=58ea5efe&sv=1)
I have added a lot of customizable parts in the mod settings how can I make it more user-friendly ?
Last updated