rendinst_modulate2x_diffuse_decal
Overview
The rendinst_modulate2x_diffuse_decal shader is used for modulating decals on
geometry within an object’s .dag file.
General Parameters:
script:t="intensity=1,0,1,0"1st component: intensity (
0and above).2nd and 3rd components: clamping range.
4th component: desaturation.
daNetifme-Based Parameters:
script:t="smoothness_metalness=1,1,0,0"1st component: affects smoothness.
2nd component: affects metalness.
The remaining components are required but have no effect.
script:t="draw_order=1"– Defines the draw order for decals. Any integer from-512to511is valid: a decal with a lower value is drawn below a decal with a higher value. The default for this shader is-10.
Functionality
The shader uses 24-bit diffuse textures (without alpha). Darker than 50% gray darkens the underlying surface, while lighter than 50% gray brightens it. This is how modulation works.
If a texture requires areas that shouldn’t affect the surface (essentially, “transparent” areas), these should be 50% gray. Applying a 50% gray modulation (for example, using Photoshop’s overlay mode) will result in no visible change.
Texture |
Result |
|---|
However, simply creating a texture with 50% gray in the “transparent” areas is
not enough. During compression, diffuse textures often get a gamma correction of
2.2, which alters brightness.
To avoid this, modulate decal textures must be processed with a gamma of 1.
These textures should be named with the suffix _tex_m, for example,
wall_dirt_spots_decal_a_tex_m.tif. Such textures are automatically processed
with gamma 1.
Parameters
General Parameters
script:t="intensity=1,0,1,0"– This parameter controls several properties:1st component: decal intensity, from
0upwards. Values below0invert the decal’s color, which can be useful for creating effects like oil stains from regular dirt.2nd and 3rd components: clamping – restricts the texture’s brightness range. The 2nd component is “from”, and the 3rd component is “to”. This allows you to display only a specific color range of the texture, making edges sharper and outlines more distinct. Anything outside the clamping range defaults to 50% gray (i.e., it has no effect on the surface).
4th component: decal desaturation, from
0to1(default is1, fully desaturated).
Examples:
script:t="intensity=0,0,1,0"– Intensity set to0.
script:t="intensity=0.5,0,1,0"– Intensity set to 50%.
script:t="intensity=1,0,1,0"– Intensity set to 100%.
script:t="intensity=-1,0,1,0"– Inverted color.
script:t="intensity=1,0,1,0"– Full color range.
script:t="intensity=1,0,0.5,0"– Clamped visible range from0to0.5(50% brightness), showing areas darker than 50%.
script:t="intensity=1,0.5,1,0"– Clamped visible range from0.5to1, showing areas brighter than 50%. You can also use different ranges, such as from0.23to0.37.
The same decals with different parameters can provide a wide range of effects with minimal effort.
daNetGame-Based Parameters
script:t="smoothness_metalness=1,1,0,0"– This parameter controls the impact on the smoothness and metalness of the underlying material. The default value is0. Reducing the value decreases the parameters, while increasing it enhances them.1st component: smoothness.
2nd component: metalness.
Important
This parameter affects the material that the decal is applied to. If the underlying material lacks metalness, for example, this parameter will have no effect.
Source decal |
script:t="smoothness_metalness=0,0,0,0" |
|---|
script:t="smoothness_metalness=1,0,0,0" |
script:t="smoothness_metalness=-1,0,0,0" |
|---|
script:t="draw_order=1"– Controls the draw order for specific decal materials. It accepts any integer from-512to511, 1024 values in total:A lower value is rendered below decals with a higher value.
A higher value is rendered above decals with a lower value.
The default for this shader is
-10. Values outside the range are not supported.
A single object can have many overlapping decals. For example, numbering each decal type shows how differently they can appear depending on the draw order:
You can see that wear decals (2) are generally bright. However, they can be darkened by soot decals (1). This is the decal layering in action, with the soot decal “above” the wear decal, applied on top of it.
Without specifying the draw order, you might encounter:
Z-fighting (where decals with the same draw order fight for visibility).
Incorrect layering, like this black seam (the soot decal should be “below” the brick edge decal, but it’s drawn “above”).
Or both issues simultaneously.
Important
If you don’t assign a draw order to any decal material, they use the shader
default (-10 for this shader). However, in-game, the system may assign its own
order because no clear hierarchy is defined. Therefore, it’s important to
specify at least the materials that should be lower than the default. This
ensures the rest will render above without issue.
For best results, set a clear draw order and don’t rely on chance.
Typically, modulate decals should get a value below the default, for example
-20, while wear decals can keep the default. Wear often looks fresher than
surrounding dirt and soot.
However, if the wear needs to appear dirty, you can either set the wear decals
below the default (for example -20), leaving modulate decals untouched, or set
the dirty modulate decals above the default (for example -5) to preserve the
overall layering scheme for modulate and diffuse decals.
Note
This parameter applies to all diffuse and modulate decals, not just this specific shader.