Implicit lightmap support for ALS model interior effect
This commit is contained in:
parent
eb847230d5
commit
e4be2917be
2 changed files with 58 additions and 6 deletions
|
@ -19,6 +19,12 @@
|
|||
<opacity-cube-center type="vec3d" n="0"> 0.0 0.0 0.0</opacity-cube-center>
|
||||
<opacity-cube-scale type="vec3d" n="0"> 1.0 1.0 1.0</opacity-cube-scale>
|
||||
<opacity-cube-angle type="float">0.0</opacity-cube-angle>
|
||||
<implicit-lightmap-enabled type="int">0</implicit-lightmap-enabled>
|
||||
<implicit-lightmap-tag-color type="vec3d">1.0 1.0 1.0</implicit-lightmap-tag-color>
|
||||
<implicit-lightmap-threshold-low type="float">0.5</implicit-lightmap-threshold-low>
|
||||
<implicit-lightmap-threshold-high type="float">1.5</implicit-lightmap-threshold-high>
|
||||
<implicit-lightmap-emit-color type="vec3d">1.0 1.0 1.0</implicit-lightmap-emit-color>
|
||||
<implicit-lightmap-intensity type="float">0.0</implicit-lightmap-intensity>
|
||||
</parameters>
|
||||
|
||||
<technique n="4">
|
||||
|
@ -154,6 +160,31 @@
|
|||
<name>angle</name>
|
||||
<type>float</type>
|
||||
<value><use>opacity-cube-angle</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>tag_color</name>
|
||||
<type>float-vec3</type>
|
||||
<value><use>implicit-lightmap-tag-color</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>emit_color</name>
|
||||
<type>float-vec3</type>
|
||||
<value><use>implicit-lightmap-emit-color</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>threshold_low</name>
|
||||
<type>float</type>
|
||||
<value><use>implicit-lightmap-threshold-low</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>threshold_high</name>
|
||||
<type>float</type>
|
||||
<value><use>implicit-lightmap-threshold-high</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>emit_intensity</name>
|
||||
<type>float</type>
|
||||
<value><use>implicit-lightmap-intensity</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
|
@ -180,6 +211,11 @@
|
|||
<type>int</type>
|
||||
<value><use>tquality_level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>implicit_lightmap_enabled</name>
|
||||
<type>int</type>
|
||||
<value><use>implicit-lightmap-enabled</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
|
||||
|
|
|
@ -24,14 +24,20 @@ uniform float overcast;
|
|||
uniform float eye_alt;
|
||||
uniform float cloud_self_shading;
|
||||
uniform float angle;
|
||||
uniform float threshold_low;
|
||||
uniform float threshold_high;
|
||||
uniform float emit_intensity;
|
||||
|
||||
uniform vec3 offset_vec;
|
||||
uniform vec3 scale_vec;
|
||||
uniform vec3 tag_color;
|
||||
uniform vec3 emit_color;
|
||||
|
||||
|
||||
uniform int quality_level;
|
||||
uniform int tquality_level;
|
||||
uniform int use_searchlight;
|
||||
uniform int implicit_lightmap_enabled;
|
||||
|
||||
|
||||
const float EarthRadius = 5800000.0;
|
||||
|
@ -145,9 +151,19 @@ void main()
|
|||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
//fragColor.rgb = vec3(1.0,1.0,1.0) * (1.0 - opacity.a);
|
||||
// implicit lightmap - the user gets to select
|
||||
|
||||
if (implicit_lightmap_enabled == 1)
|
||||
{
|
||||
float cdiff = (length(texel.rgb - tag_color));
|
||||
float enhance = 1.0 - smoothstep(threshold_low, threshold_high, cdiff);
|
||||
fragColor.rgb = fragColor.rgb + enhance * emit_color * emit_intensity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue