Add 2 more dirt channels - "green" and "blue"
Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
parent
a51cb4a280
commit
cfb86efb84
2 changed files with 72 additions and 14 deletions
|
@ -91,8 +91,13 @@ please see Docs/README.model-combined.eff for documentation
|
|||
<!-- END Reflection -->
|
||||
<!-- Dirt -->
|
||||
<dirt-enabled type="int">0</dirt-enabled>
|
||||
<dirt-color type="vec3d">0.0 0.0 0.0</dirt-color>
|
||||
<dirt-factor type="float">0.0</dirt-factor>
|
||||
<dirt-multi type="int">0</dirt-multi>
|
||||
<dirt-color type="vec3d" n="0">0.0 0.0 0.0</dirt-color>
|
||||
<dirt-factor type="float" n="0">0.0</dirt-factor>
|
||||
<dirt-color type="vec3d" n="1">0.0 0.0 0.0</dirt-color>
|
||||
<dirt-factor type="float" n="1">0.0</dirt-factor>
|
||||
<dirt-color type="vec3d" n="2">0.0 0.0 0.0</dirt-color>
|
||||
<dirt-factor type="float" n="2">0.0</dirt-factor>
|
||||
<!-- ambient correction -->
|
||||
<ambient-correction type="float">0.05</ambient-correction>
|
||||
<!-- quality slider -->
|
||||
|
@ -602,20 +607,61 @@ please see Docs/README.model-combined.eff for documentation
|
|||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_color</name>
|
||||
<type>float-vec3</type>
|
||||
<name>dirt_multi</name>
|
||||
<type>int</type>
|
||||
<value>
|
||||
<use>dirt-color</use>
|
||||
<use>dirt-multi</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_factor</name>
|
||||
<type>float</type>
|
||||
<name>dirt_r_color</name>
|
||||
<type>float-vec3</type>
|
||||
<value>
|
||||
<use>dirt-factor</use>
|
||||
<use>dirt-color[0]</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_r_factor</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>dirt-factor[0]</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_g_color</name>
|
||||
<type>float-vec3</type>
|
||||
<value>
|
||||
<use>dirt-color[1]</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_g_factor</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>dirt-factor[1]</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_b_color</name>
|
||||
<type>float-vec3</type>
|
||||
<value>
|
||||
<use>dirt-color[2]</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<uniform>
|
||||
<name>dirt_b_factor</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>dirt-factor[2]</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
<!-- set the amount of ambient light correction 0.0 - 1.0 -->
|
||||
<uniform>
|
||||
<name>amb_correction</name>
|
||||
|
|
|
@ -32,6 +32,7 @@ uniform int lightmap_enabled;
|
|||
uniform int lightmap_multi;
|
||||
uniform int shader_qual;
|
||||
uniform int dirt_enabled;
|
||||
uniform int dirt_multi;
|
||||
|
||||
uniform float lightmap_r_factor;
|
||||
uniform float lightmap_g_factor;
|
||||
|
@ -42,14 +43,18 @@ uniform float refl_fresnel;
|
|||
uniform float refl_rainbow;
|
||||
uniform float refl_noise;
|
||||
uniform float amb_correction;
|
||||
uniform float dirt_factor;
|
||||
uniform float dirt_r_factor;
|
||||
uniform float dirt_g_factor;
|
||||
uniform float dirt_b_factor;
|
||||
|
||||
uniform vec3 lightmap_r_color;
|
||||
uniform vec3 lightmap_g_color;
|
||||
uniform vec3 lightmap_b_color;
|
||||
uniform vec3 lightmap_a_color;
|
||||
|
||||
uniform vec3 dirt_color;
|
||||
uniform vec3 dirt_r_color;
|
||||
uniform vec3 dirt_g_color;
|
||||
uniform vec3 dirt_b_color;
|
||||
|
||||
///fog include//////////////////////
|
||||
uniform int fogType;
|
||||
|
@ -151,10 +156,17 @@ void main (void)
|
|||
//begin DIRT
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
if (dirt_enabled > 0.0){
|
||||
vec3 dirtColor = dirt_color * noisevec.rgb;
|
||||
float dirtFactor = reflmap.r * dirt_factor;
|
||||
dirtFactor = smoothstep(0.0, 1.0, dirtFactor);
|
||||
fragColor.rgb = mix(fragColor.rgb, dirtColor, dirtFactor);
|
||||
float dirtFactorR = reflmap.r * dirt_r_factor;
|
||||
dirtFactorR = smoothstep(0.0, 1.0, dirtFactorR);
|
||||
fragColor.rgb = mix(fragColor.rgb, dirt_r_color, dirtFactorR);
|
||||
if (dirt_multi > 0) {
|
||||
float dirtFactorG = reflmap.g * dirt_g_factor;
|
||||
float dirtFactorB = reflmap.b * dirt_b_factor;
|
||||
dirtFactorG = smoothstep(0.0, 1.0, dirtFactorG);
|
||||
dirtFactorB = smoothstep(0.0, 1.0, dirtFactorB);
|
||||
fragColor.rgb = mix(fragColor.rgb, dirt_g_color, dirtFactorG);
|
||||
fragColor.rgb = mix(fragColor.rgb, dirt_b_color, dirtFactorB);
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//END Dirt
|
||||
|
|
Loading…
Reference in a new issue