Dirty
Shader
Dirty coloring allows you to mix another texture to your base material. You can use the same drawcall operation without having to paste a decal. This mixed texture requires a transparent channel, and controls the amount of mixing through the transparency of vertices in your model shader attribute. In addition, you can specify tiling and alpha for this dirty texture. Because the diffuse texture of the dirty texture and the basic material uses the same UV value, you can use the tiling parameter to eliminate the effect of texture duplication.
In3DS MAXSet in
In 3DS MAX, You can visually adjust the mixing and UV layout of the two textures. DirectX dirt shader can be used here. DirectX dirt shader will copy dirt shader in cryengine, which follows Max and will not be exported to cryengine as expected. So here is a max script that can help you easily convert the basic material to the DirectX dirt shader under the temporary Max.
Workflow
The model and texture of your object must be standard material and diffuse texture
Convert standard Max material to DirectX dirt shader
Create and dirty textures to your DirectX dirt shader
Apply the vertex transparency on your model to create its hybrid Effect
Switch back to your standard Max Material
Export your object to cryengine
Create the dirt shader material in cryengine.
Required files
DirectX dirt shader:Main \ tools \ maxscrit \ FX \ cryblendshader. FX
Maxscript:Main \ tools \ maxscript \ crymakeblendshader. Ms
1. Copy the diffusebumpblend. FX fileYourproject \ tools \ maxscript \ FXDirectory.
2. Copy the crymakeblendshader. Ms fileYourproject \ tools \ maxscriptDirectory
UseCrymakeblendshader. Ms
This script requires you to select an object and create a composite material (with multiple seed materials) for it ). Use DirectX dirt shader for each self-built material (two sub-objects will be created in the new material editor ). It will automatically allocate the original diffuse and normal texture, but the dirty texture in the shader will be empty, you must manually select the dirty texture for each material.
1. Run the script to open a small object box.
2. Select your object
3. Press the button to create a hybrid shader in the script dialog box.
4. The material editor will be opened.
Select box 1 to include your original material
Select Box 2 to include the new DirectX material (not assigned to your ide object)
5. Specify the new material to your object (from slot 2)
6. Do not delete or overwrite the original material in slot 1; otherwise it will be lost.
7. Use diffusemap2 for the desired dirty texture for each sub-Material
See the description of the DirectX dirt shader parameter in Max below. And control the performance of dirty objects.
Note:When multiple materials of a DirectX dirt shader are used, the sub-Material ID cannot be as "Wrap" as the standard material, and the sub-material must have the correct ID number, otherwise, after you apply the direct dirt shader material, your object will change to the box frame mode. This may be because the child material IDs used by those faces are out of the correct ID range.
In3 DSMAXCreateDirectX dirt shader
Create a new DirectX material and load the diffusebumpblend. FX file under the DirectX shader label.
Diffusemap1:Load basic texture
Diffusemap2:Load dirty texture
Normalmap:Load the normalmap of the basic texture
Dirttint:Allow you to color dirty textures
Dirtstrength:Allows you to set the overall opacity of the dirty texture
Dirt map alpha:Allows you to start or disable transparent channels with dirty textures
Dirt tiling:Allows you to adjust the repeated parameters of the texture-use this value to adjust the UV of the basic texture
Remember, you can create a dirt shader for your multiple material objects. Do not convert them back to crytek shader before exporting your model.
Apply the dirty effect on objects
To use the shader, you need to add a vertexpaintiugai for your model and set its channel to vertex Alpha. You can plot the affected areas. Brown indicates that the opacity of your dirty layer is % 100, it is completely visible, and white is not limited to any dirt. Different gray colors will be mixed with the base texture. You can select a set of vertices to set an Alpha value for them. When the vertex is selected, the Alpha value can be set under the vertex Properties tab.
In order to see the transparency of the vertex in the video, right-click your object, select the vertex channel display, and set it to vertexalpha.
InCryengineUsed in
Currently, dirt shader can only be applied under iiium shader. First load your dirt texture in the shader custom slot. Then check the dirty layer under shader generation Param to start dirt shader parameters. You can manually set parameters that match DirectX dirt shader under Max for each dirt shader.
Dirt tint allows you to color the texture. White indicates no color.
Dirt strenth allows you to set the opacity of the dirty texture.
Dirt gloss allows you to set the glow level of dirty textures
Dirt tiling allows you to set the ing and scaling of dirty textures.
Use dirty texture
With dirt shader, you can add object details without compromising performance. But only for small tiling textures and a few materials, dirtshader allows you to make objects more diversified without adding more textures. By using Vertex Alpha, you can ensure that you can still add additional coloring information to the mesh using the vertex color.
Each dirty texture can be reused on other resources. Your goal should be to create a texture library to handle dirty effects for all basic materials.
Crop and draw(Clipped paint)
Below is a 256x256-based concrete texture block. This dirty texture is a white concrete texture with transparent channels. It is used to create the "Clipped paint" effect in the mask of transparent channels. The dirty texture of the 512x512 is used as the base color to maintain the clarity of the mask.
You can easily use the tint attribute in the shader to color the dirty texture. Vertex Alpha is transparent by adding edges and modifying vertices ). You can specify your desired texture for blending.
Walls and other objects
You can see that different types of materials use the same dirty masking effect.
Add different effects to basic objects
In some cases, creating a uniform dirty texture is more effective than a single dirty texture.
For example, in the following example, metal plates are used to create a building roof. This means that these objects are frequently used and require very good results. To do this, you should define shapes for these metal plates. To use more textures, make sure that the texture space they use is used to the maximum extent possible. Create a mask effect after the software is soft, specify which metal plates will be colored (in which way) and pre-define the created object slices.
MajorityDirtshaderApplicable
Create an interesting dirty texture for the basic texture block starting with a basic texture block. Use vertex colors to add subtle color changes and environmental blocking effects. Make sure to use these three steps as much as possible.
Reuse dirty textures
If you have a good basic texture and normalmap. Before creating a new dirty texture, try to reuse the existing dirty texture and mask effect on your material. Generally, you can achieve the same effect as the texture processing and coloring functions in the existing shader, which can save texture memory and time.
Author: Wuhua wujiu Source: wine.