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
|
@ -5,7 +5,7 @@
|
||||||
<inherits-from>Effects/model-default</inherits-from>
|
<inherits-from>Effects/model-default</inherits-from>
|
||||||
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<texture n="4">
|
<texture n="4">
|
||||||
<type>cubemap</type>
|
<type>cubemap</type>
|
||||||
<images>
|
<images>
|
||||||
<positive-x>Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_px.png</positive-x>
|
<positive-x>Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_px.png</positive-x>
|
||||||
|
@ -15,10 +15,16 @@
|
||||||
<positive-z>Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_pz.png</positive-z>
|
<positive-z>Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_pz.png</positive-z>
|
||||||
<negative-z>Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_nz.png</negative-z>
|
<negative-z>Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_nz.png</negative-z>
|
||||||
</images>
|
</images>
|
||||||
</texture>
|
</texture>
|
||||||
<opacity-cube-center type="vec3d" n="0"> 0.0 0.0 0.0</opacity-cube-center>
|
<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-scale type="vec3d" n="0"> 1.0 1.0 1.0</opacity-cube-scale>
|
||||||
<opacity-cube-angle type="float">0.0</opacity-cube-angle>
|
<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>
|
</parameters>
|
||||||
|
|
||||||
<technique n="4">
|
<technique n="4">
|
||||||
|
@ -154,6 +160,31 @@
|
||||||
<name>angle</name>
|
<name>angle</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>opacity-cube-angle</use></value>
|
<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>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>texture</name>
|
<name>texture</name>
|
||||||
|
@ -180,6 +211,11 @@
|
||||||
<type>int</type>
|
<type>int</type>
|
||||||
<value><use>tquality_level</use></value>
|
<value><use>tquality_level</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>implicit_lightmap_enabled</name>
|
||||||
|
<type>int</type>
|
||||||
|
<value><use>implicit-lightmap-enabled</use></value>
|
||||||
|
</uniform>
|
||||||
</pass>
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,20 @@ uniform float overcast;
|
||||||
uniform float eye_alt;
|
uniform float eye_alt;
|
||||||
uniform float cloud_self_shading;
|
uniform float cloud_self_shading;
|
||||||
uniform float angle;
|
uniform float angle;
|
||||||
|
uniform float threshold_low;
|
||||||
|
uniform float threshold_high;
|
||||||
|
uniform float emit_intensity;
|
||||||
|
|
||||||
uniform vec3 offset_vec;
|
uniform vec3 offset_vec;
|
||||||
uniform vec3 scale_vec;
|
uniform vec3 scale_vec;
|
||||||
|
uniform vec3 tag_color;
|
||||||
|
uniform vec3 emit_color;
|
||||||
|
|
||||||
|
|
||||||
uniform int quality_level;
|
uniform int quality_level;
|
||||||
uniform int tquality_level;
|
uniform int tquality_level;
|
||||||
uniform int use_searchlight;
|
uniform int use_searchlight;
|
||||||
|
uniform int implicit_lightmap_enabled;
|
||||||
|
|
||||||
|
|
||||||
const float EarthRadius = 5800000.0;
|
const float EarthRadius = 5800000.0;
|
||||||
|
@ -145,9 +151,19 @@ void main()
|
||||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||||
fragColor = color * texel + specular;
|
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;
|
gl_FragColor = fragColor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue