1
0
Fork 0

Cloud shadows for urban effect/random buildings

This commit is contained in:
Thorsten Renk 2014-03-11 11:53:57 +02:00
parent fadc3bf7fa
commit a05863e541
5 changed files with 699 additions and 36 deletions

View file

@ -184,6 +184,7 @@
<program>
<vertex-shader n="1">Shaders/building-ubershader.vert</vertex-shader>
<fragment-shader n="1">Shaders/ubershader-lightfield.frag</fragment-shader>
<fragment-shader n="2">Shaders/cloud-shadowfunc.frag</fragment-shader>
</program>
</pass>
</technique>

View file

@ -127,27 +127,54 @@ please see Docs/README.model-combined.eff for documentation
<use>orientation/model/roll-deg</use>
</model-roll>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/shaders/skydome</use>
</fogtype>
<rembrandt>
<use>/sim/rendering/rembrandt/enabled</use>
</rembrandt>
<visibility><use>/environment/ground-visibility-m</use></visibility>
<avisibility><use>/environment/visibility-m</use></avisibility>
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
<scattering><use>/rendering/scene/scattering</use></scattering>
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x>
<cloudpos1_y><use>/local-weather/cloud-shadows/cloudpos-y[0]</use></cloudpos1_y>
<cloudpos2_x><use>/local-weather/cloud-shadows/cloudpos-x[1]</use></cloudpos2_x>
<cloudpos2_y><use>/local-weather/cloud-shadows/cloudpos-y[1]</use></cloudpos2_y>
<cloudpos3_x><use>/local-weather/cloud-shadows/cloudpos-x[2]</use></cloudpos3_x>
<cloudpos3_y><use>/local-weather/cloud-shadows/cloudpos-y[2]</use></cloudpos3_y>
<cloudpos4_x><use>/local-weather/cloud-shadows/cloudpos-x[3]</use></cloudpos4_x>
<cloudpos4_y><use>/local-weather/cloud-shadows/cloudpos-y[3]</use></cloudpos4_y>
<cloudpos5_x><use>/local-weather/cloud-shadows/cloudpos-x[4]</use></cloudpos5_x>
<cloudpos5_y><use>/local-weather/cloud-shadows/cloudpos-y[4]</use></cloudpos5_y>
<cloudpos6_x><use>/local-weather/cloud-shadows/cloudpos-x[5]</use></cloudpos6_x>
<cloudpos6_y><use>/local-weather/cloud-shadows/cloudpos-y[5]</use></cloudpos6_y>
<cloudpos7_x><use>/local-weather/cloud-shadows/cloudpos-x[6]</use></cloudpos7_x>
<cloudpos7_y><use>/local-weather/cloud-shadows/cloudpos-y[6]</use></cloudpos7_y>
<cloudpos8_x><use>/local-weather/cloud-shadows/cloudpos-x[7]</use></cloudpos8_x>
<cloudpos8_y><use>/local-weather/cloud-shadows/cloudpos-y[7]</use></cloudpos8_y>
<cloudpos9_x><use>/local-weather/cloud-shadows/cloudpos-x[8]</use></cloudpos9_x>
<cloudpos9_y><use>/local-weather/cloud-shadows/cloudpos-y[8]</use></cloudpos9_y>
<cloudpos10_x><use>/local-weather/cloud-shadows/cloudpos-x[9]</use></cloudpos10_x>
<cloudpos10_y><use>/local-weather/cloud-shadows/cloudpos-y[9]</use></cloudpos10_y>
<cloudpos11_x><use>/local-weather/cloud-shadows/cloudpos-x[10]</use></cloudpos11_x>
<cloudpos11_y><use>/local-weather/cloud-shadows/cloudpos-y[10]</use></cloudpos11_y>
<cloudpos12_x><use>/local-weather/cloud-shadows/cloudpos-x[11]</use></cloudpos12_x>
<cloudpos12_y><use>/local-weather/cloud-shadows/cloudpos-y[11]</use></cloudpos12_y>
<cloudpos13_x><use>/local-weather/cloud-shadows/cloudpos-x[12]</use></cloudpos13_x>
<cloudpos13_y><use>/local-weather/cloud-shadows/cloudpos-y[12]</use></cloudpos13_y>
<cloudpos14_x><use>/local-weather/cloud-shadows/cloudpos-x[13]</use></cloudpos14_x>
<cloudpos14_y><use>/local-weather/cloud-shadows/cloudpos-y[13]</use></cloudpos14_y>
<cloudpos15_x><use>/local-weather/cloud-shadows/cloudpos-x[14]</use></cloudpos15_x>
<cloudpos15_y><use>/local-weather/cloud-shadows/cloudpos-y[14]</use></cloudpos15_y>
<cloudpos16_x><use>/local-weather/cloud-shadows/cloudpos-x[15]</use></cloudpos16_x>
<cloudpos16_y><use>/local-weather/cloud-shadows/cloudpos-y[15]</use></cloudpos16_y>
<cloudpos17_x><use>/local-weather/cloud-shadows/cloudpos-x[16]</use></cloudpos17_x>
<cloudpos17_y><use>/local-weather/cloud-shadows/cloudpos-y[16]</use></cloudpos17_y>
<cloudpos18_x><use>/local-weather/cloud-shadows/cloudpos-x[17]</use></cloudpos18_x>
<cloudpos18_y><use>/local-weather/cloud-shadows/cloudpos-y[17]</use></cloudpos18_y>
<cloudpos19_x><use>/local-weather/cloud-shadows/cloudpos-x[18]</use></cloudpos19_x>
<cloudpos19_y><use>/local-weather/cloud-shadows/cloudpos-y[18]</use></cloudpos19_y>
<cloudpos20_x><use>/local-weather/cloud-shadows/cloudpos-x[19]</use></cloudpos20_x>
<cloudpos20_y><use>/local-weather/cloud-shadows/cloudpos-y[19]</use></cloudpos20_y>
<cloud_shadow_flag><use>/local-weather/cloud-shadows/cloud-shadow-flag</use></cloud_shadow_flag>
<rembrandt><use>/sim/rendering/rembrandt/enabled</use></rembrandt>
<!-- END fog include -->
</parameters>
@ -397,6 +424,7 @@ please see Docs/README.model-combined.eff for documentation
<program>
<vertex-shader n="1">Shaders/ubershader.vert</vertex-shader>
<fragment-shader n="1">Shaders/ubershader-lightfield.frag</fragment-shader>
<fragment-shader n="2">Shaders/cloud-shadowfunc.frag</fragment-shader>
</program>
<uniform>
@ -804,16 +832,221 @@ please see Docs/README.model-combined.eff for documentation
<use>eye_alt</use>
</value>
</uniform>
<uniform>
<name>cloud_self_shading</name>
<type>float</type>
<value><use>cloud_self_shading</use></value>
</uniform>
<uniform>
<name>moonlight</name>
<type>float</type>
<value><use>moonlight</use></value>
</uniform>
<uniform>
<name>cloud_self_shading</name>
<type>float</type>
<value><use>cloud_self_shading</use></value>
</uniform>
<uniform>
<name>moonlight</name>
<type>float</type>
<value><use>moonlight</use></value>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
<value><use>cloudpos1_x</use></value>
</uniform>
<uniform>
<name>cloudpos1_y</name>
<type>float</type>
<value><use>cloudpos1_y</use></value>
</uniform>
<uniform>
<name>cloudpos2_x</name>
<type>float</type>
<value><use>cloudpos2_x</use></value>
</uniform>
<uniform>
<name>cloudpos2_y</name>
<type>float</type>
<value><use>cloudpos2_y</use></value>
</uniform>
<uniform>
<name>cloudpos3_x</name>
<type>float</type>
<value><use>cloudpos3_x</use></value>
</uniform>
<uniform>
<name>cloudpos3_y</name>
<type>float</type>
<value><use>cloudpos3_y</use></value>
</uniform>
<uniform>
<name>cloudpos4_x</name>
<type>float</type>
<value><use>cloudpos4_x</use></value>
</uniform>
<uniform>
<name>cloudpos4_y</name>
<type>float</type>
<value><use>cloudpos4_y</use></value>
</uniform>
<uniform>
<name>cloudpos5_x</name>
<type>float</type>
<value><use>cloudpos5_x</use></value>
</uniform>
<uniform>
<name>cloudpos5_y</name>
<type>float</type>
<value><use>cloudpos5_y</use></value>
</uniform>
<uniform>
<name>cloudpos6_x</name>
<type>float</type>
<value><use>cloudpos6_x</use></value>
</uniform>
<uniform>
<name>cloudpos6_y</name>
<type>float</type>
<value><use>cloudpos6_y</use></value>
</uniform>
<uniform>
<name>cloudpos7_x</name>
<type>float</type>
<value><use>cloudpos7_x</use></value>
</uniform>
<uniform>
<name>cloudpos7_y</name>
<type>float</type>
<value><use>cloudpos7_y</use></value>
</uniform>
<uniform>
<name>cloudpos8_x</name>
<type>float</type>
<value><use>cloudpos8_x</use></value>
</uniform>
<uniform>
<name>cloudpos8_y</name>
<type>float</type>
<value><use>cloudpos8_y</use></value>
</uniform>
<uniform>
<name>cloudpos9_x</name>
<type>float</type>
<value><use>cloudpos9_x</use></value>
</uniform>
<uniform>
<name>cloudpos9_y</name>
<type>float</type>
<value><use>cloudpos9_y</use></value>
</uniform>
<uniform>
<name>cloudpos10_x</name>
<type>float</type>
<value><use>cloudpos10_x</use></value>
</uniform>
<uniform>
<name>cloudpos10_y</name>
<type>float</type>
<value><use>cloudpos10_y</use></value>
</uniform>
<uniform>
<name>cloudpos11_x</name>
<type>float</type>
<value><use>cloudpos11_x</use></value>
</uniform>
<uniform>
<name>cloudpos11_y</name>
<type>float</type>
<value><use>cloudpos11_y</use></value>
</uniform>
<uniform>
<name>cloudpos12_x</name>
<type>float</type>
<value><use>cloudpos12_x</use></value>
</uniform>
<uniform>
<name>cloudpos12_y</name>
<type>float</type>
<value><use>cloudpos12_y</use></value>
</uniform>
<uniform>
<name>cloudpos13_x</name>
<type>float</type>
<value><use>cloudpos13_x</use></value>
</uniform>
<uniform>
<name>cloudpos13_y</name>
<type>float</type>
<value><use>cloudpos13_y</use></value>
</uniform>
<uniform>
<name>cloudpos14_x</name>
<type>float</type>
<value><use>cloudpos14_x</use></value>
</uniform>
<uniform>
<name>cloudpos14_y</name>
<type>float</type>
<value><use>cloudpos14_y</use></value>
</uniform>
<uniform>
<name>cloudpos15_x</name>
<type>float</type>
<value><use>cloudpos15_x</use></value>
</uniform>
<uniform>
<name>cloudpos15_y</name>
<type>float</type>
<value><use>cloudpos15_y</use></value>
</uniform>
<uniform>
<name>cloudpos16_x</name>
<type>float</type>
<value><use>cloudpos16_x</use></value>
</uniform>
<uniform>
<name>cloudpos16_y</name>
<type>float</type>
<value><use>cloudpos16_y</use></value>
</uniform>
<uniform>
<name>cloudpos17_x</name>
<type>float</type>
<value><use>cloudpos17_x</use></value>
</uniform>
<uniform>
<name>cloudpos17_y</name>
<type>float</type>
<value><use>cloudpos17_y</use></value>
</uniform>
<uniform>
<name>cloudpos18_x</name>
<type>float</type>
<value><use>cloudpos18_x</use></value>
</uniform>
<uniform>
<name>cloudpos18_y</name>
<type>float</type>
<value><use>cloudpos18_y</use></value>
</uniform>
<uniform>
<name>cloudpos19_x</name>
<type>float</type>
<value><use>cloudpos19_x</use></value>
</uniform>
<uniform>
<name>cloudpos19_y</name>
<type>float</type>
<value><use>cloudpos19_y</use></value>
</uniform>
<uniform>
<name>cloudpos20_x</name>
<type>float</type>
<value><use>cloudpos20_x</use></value>
</uniform>
<uniform>
<name>cloudpos20_y</name>
<type>float</type>
<value><use>cloudpos20_y</use></value>
</uniform>
<uniform>
<name>cloud_shadow_flag</name>
<type>int</type>
<value><use>cloud_shadow_flag</use></value>
</uniform>
<!-- END fog include -->
<uniform>
<name>rembrandt_enabled</name>

View file

@ -173,8 +173,8 @@
</texture-unit>
<program>
<vertex-shader>Shaders/urban-lightfield.vert</vertex-shader>
<fragment-shader>Shaders/urban-lightfield.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
@ -343,6 +343,213 @@
<type>float</type>
<value><use>moonlight</use></value>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
<value><use>cloudpos1_x</use></value>
</uniform>
<uniform>
<name>cloudpos1_y</name>
<type>float</type>
<value><use>cloudpos1_y</use></value>
</uniform>
<uniform>
<name>cloudpos2_x</name>
<type>float</type>
<value><use>cloudpos2_x</use></value>
</uniform>
<uniform>
<name>cloudpos2_y</name>
<type>float</type>
<value><use>cloudpos2_y</use></value>
</uniform>
<uniform>
<name>cloudpos3_x</name>
<type>float</type>
<value><use>cloudpos3_x</use></value>
</uniform>
<uniform>
<name>cloudpos3_y</name>
<type>float</type>
<value><use>cloudpos3_y</use></value>
</uniform>
<uniform>
<name>cloudpos4_x</name>
<type>float</type>
<value><use>cloudpos4_x</use></value>
</uniform>
<uniform>
<name>cloudpos4_y</name>
<type>float</type>
<value><use>cloudpos4_y</use></value>
</uniform>
<uniform>
<name>cloudpos5_x</name>
<type>float</type>
<value><use>cloudpos5_x</use></value>
</uniform>
<uniform>
<name>cloudpos5_y</name>
<type>float</type>
<value><use>cloudpos5_y</use></value>
</uniform>
<uniform>
<name>cloudpos6_x</name>
<type>float</type>
<value><use>cloudpos6_x</use></value>
</uniform>
<uniform>
<name>cloudpos6_y</name>
<type>float</type>
<value><use>cloudpos6_y</use></value>
</uniform>
<uniform>
<name>cloudpos7_x</name>
<type>float</type>
<value><use>cloudpos7_x</use></value>
</uniform>
<uniform>
<name>cloudpos7_y</name>
<type>float</type>
<value><use>cloudpos7_y</use></value>
</uniform>
<uniform>
<name>cloudpos8_x</name>
<type>float</type>
<value><use>cloudpos8_x</use></value>
</uniform>
<uniform>
<name>cloudpos8_y</name>
<type>float</type>
<value><use>cloudpos8_y</use></value>
</uniform>
<uniform>
<name>cloudpos9_x</name>
<type>float</type>
<value><use>cloudpos9_x</use></value>
</uniform>
<uniform>
<name>cloudpos9_y</name>
<type>float</type>
<value><use>cloudpos9_y</use></value>
</uniform>
<uniform>
<name>cloudpos10_x</name>
<type>float</type>
<value><use>cloudpos10_x</use></value>
</uniform>
<uniform>
<name>cloudpos10_y</name>
<type>float</type>
<value><use>cloudpos10_y</use></value>
</uniform>
<uniform>
<name>cloudpos11_x</name>
<type>float</type>
<value><use>cloudpos11_x</use></value>
</uniform>
<uniform>
<name>cloudpos11_y</name>
<type>float</type>
<value><use>cloudpos11_y</use></value>
</uniform>
<uniform>
<name>cloudpos12_x</name>
<type>float</type>
<value><use>cloudpos12_x</use></value>
</uniform>
<uniform>
<name>cloudpos12_y</name>
<type>float</type>
<value><use>cloudpos12_y</use></value>
</uniform>
<uniform>
<name>cloudpos13_x</name>
<type>float</type>
<value><use>cloudpos13_x</use></value>
</uniform>
<uniform>
<name>cloudpos13_y</name>
<type>float</type>
<value><use>cloudpos13_y</use></value>
</uniform>
<uniform>
<name>cloudpos14_x</name>
<type>float</type>
<value><use>cloudpos14_x</use></value>
</uniform>
<uniform>
<name>cloudpos14_y</name>
<type>float</type>
<value><use>cloudpos14_y</use></value>
</uniform>
<uniform>
<name>cloudpos15_x</name>
<type>float</type>
<value><use>cloudpos15_x</use></value>
</uniform>
<uniform>
<name>cloudpos15_y</name>
<type>float</type>
<value><use>cloudpos15_y</use></value>
</uniform>
<uniform>
<name>cloudpos16_x</name>
<type>float</type>
<value><use>cloudpos16_x</use></value>
</uniform>
<uniform>
<name>cloudpos16_y</name>
<type>float</type>
<value><use>cloudpos16_y</use></value>
</uniform>
<uniform>
<name>cloudpos17_x</name>
<type>float</type>
<value><use>cloudpos17_x</use></value>
</uniform>
<uniform>
<name>cloudpos17_y</name>
<type>float</type>
<value><use>cloudpos17_y</use></value>
</uniform>
<uniform>
<name>cloudpos18_x</name>
<type>float</type>
<value><use>cloudpos18_x</use></value>
</uniform>
<uniform>
<name>cloudpos18_y</name>
<type>float</type>
<value><use>cloudpos18_y</use></value>
</uniform>
<uniform>
<name>cloudpos19_x</name>
<type>float</type>
<value><use>cloudpos19_x</use></value>
</uniform>
<uniform>
<name>cloudpos19_y</name>
<type>float</type>
<value><use>cloudpos19_y</use></value>
</uniform>
<uniform>
<name>cloudpos20_x</name>
<type>float</type>
<value><use>cloudpos20_x</use></value>
</uniform>
<uniform>
<name>cloudpos20_y</name>
<type>float</type>
<value><use>cloudpos20_y</use></value>
</uniform>
<uniform>
<name>cloud_shadow_flag</name>
<type>int</type>
<value><use>cloud_shadow_flag</use></value>
</uniform>
<!-- END fog include -->
</pass>
@ -452,6 +659,7 @@
<program>
<vertex-shader>Shaders/urban-lightfield.vert</vertex-shader>
<fragment-shader>Shaders/urban-lightfield.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
<attribute>
<name>tangent</name>
@ -542,7 +750,212 @@
<name>fogstructure</name>
<type>float</type>
<value><use>fogstructure</use></value>
</uniform>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
<value><use>cloudpos1_x</use></value>
</uniform>
<uniform>
<name>cloudpos1_y</name>
<type>float</type>
<value><use>cloudpos1_y</use></value>
</uniform>
<uniform>
<name>cloudpos2_x</name>
<type>float</type>
<value><use>cloudpos2_x</use></value>
</uniform>
<uniform>
<name>cloudpos2_y</name>
<type>float</type>
<value><use>cloudpos2_y</use></value>
</uniform>
<uniform>
<name>cloudpos3_x</name>
<type>float</type>
<value><use>cloudpos3_x</use></value>
</uniform>
<uniform>
<name>cloudpos3_y</name>
<type>float</type>
<value><use>cloudpos3_y</use></value>
</uniform>
<uniform>
<name>cloudpos4_x</name>
<type>float</type>
<value><use>cloudpos4_x</use></value>
</uniform>
<uniform>
<name>cloudpos4_y</name>
<type>float</type>
<value><use>cloudpos4_y</use></value>
</uniform>
<uniform>
<name>cloudpos5_x</name>
<type>float</type>
<value><use>cloudpos5_x</use></value>
</uniform>
<uniform>
<name>cloudpos5_y</name>
<type>float</type>
<value><use>cloudpos5_y</use></value>
</uniform>
<uniform>
<name>cloudpos6_x</name>
<type>float</type>
<value><use>cloudpos6_x</use></value>
</uniform>
<uniform>
<name>cloudpos6_y</name>
<type>float</type>
<value><use>cloudpos6_y</use></value>
</uniform>
<uniform>
<name>cloudpos7_x</name>
<type>float</type>
<value><use>cloudpos7_x</use></value>
</uniform>
<uniform>
<name>cloudpos7_y</name>
<type>float</type>
<value><use>cloudpos7_y</use></value>
</uniform>
<uniform>
<name>cloudpos8_x</name>
<type>float</type>
<value><use>cloudpos8_x</use></value>
</uniform>
<uniform>
<name>cloudpos8_y</name>
<type>float</type>
<value><use>cloudpos8_y</use></value>
</uniform>
<uniform>
<name>cloudpos9_x</name>
<type>float</type>
<value><use>cloudpos9_x</use></value>
</uniform>
<uniform>
<name>cloudpos9_y</name>
<type>float</type>
<value><use>cloudpos9_y</use></value>
</uniform>
<uniform>
<name>cloudpos10_x</name>
<type>float</type>
<value><use>cloudpos10_x</use></value>
</uniform>
<uniform>
<name>cloudpos10_y</name>
<type>float</type>
<value><use>cloudpos10_y</use></value>
</uniform>
<uniform>
<name>cloudpos11_x</name>
<type>float</type>
<value><use>cloudpos11_x</use></value>
</uniform>
<uniform>
<name>cloudpos11_y</name>
<type>float</type>
<value><use>cloudpos11_y</use></value>
</uniform>
<uniform>
<name>cloudpos12_x</name>
<type>float</type>
<value><use>cloudpos12_x</use></value>
</uniform>
<uniform>
<name>cloudpos12_y</name>
<type>float</type>
<value><use>cloudpos12_y</use></value>
</uniform>
<uniform>
<name>cloudpos13_x</name>
<type>float</type>
<value><use>cloudpos13_x</use></value>
</uniform>
<uniform>
<name>cloudpos13_y</name>
<type>float</type>
<value><use>cloudpos13_y</use></value>
</uniform>
<uniform>
<name>cloudpos14_x</name>
<type>float</type>
<value><use>cloudpos14_x</use></value>
</uniform>
<uniform>
<name>cloudpos14_y</name>
<type>float</type>
<value><use>cloudpos14_y</use></value>
</uniform>
<uniform>
<name>cloudpos15_x</name>
<type>float</type>
<value><use>cloudpos15_x</use></value>
</uniform>
<uniform>
<name>cloudpos15_y</name>
<type>float</type>
<value><use>cloudpos15_y</use></value>
</uniform>
<uniform>
<name>cloudpos16_x</name>
<type>float</type>
<value><use>cloudpos16_x</use></value>
</uniform>
<uniform>
<name>cloudpos16_y</name>
<type>float</type>
<value><use>cloudpos16_y</use></value>
</uniform>
<uniform>
<name>cloudpos17_x</name>
<type>float</type>
<value><use>cloudpos17_x</use></value>
</uniform>
<uniform>
<name>cloudpos17_y</name>
<type>float</type>
<value><use>cloudpos17_y</use></value>
</uniform>
<uniform>
<name>cloudpos18_x</name>
<type>float</type>
<value><use>cloudpos18_x</use></value>
</uniform>
<uniform>
<name>cloudpos18_y</name>
<type>float</type>
<value><use>cloudpos18_y</use></value>
</uniform>
<uniform>
<name>cloudpos19_x</name>
<type>float</type>
<value><use>cloudpos19_x</use></value>
</uniform>
<uniform>
<name>cloudpos19_y</name>
<type>float</type>
<value><use>cloudpos19_y</use></value>
</uniform>
<uniform>
<name>cloudpos20_x</name>
<type>float</type>
<value><use>cloudpos20_x</use></value>
</uniform>
<uniform>
<name>cloudpos20_y</name>
<type>float</type>
<value><use>cloudpos20_y</use></value>
</uniform>
<uniform>
<name>cloud_shadow_flag</name>
<type>int</type>
<value><use>cloud_shadow_flag</use></value>
</uniform>
<!-- END fog include -->
<uniform>

View file

@ -37,6 +37,7 @@ uniform int nmap_enabled;
uniform int refl_enabled;
uniform int refl_map;
uniform int grain_texture_enabled;
uniform int cloud_shadow_flag;
uniform float amb_correction;
uniform float dirt_b_factor;
@ -80,6 +81,8 @@ uniform vec3 dirt_r_color;
uniform vec3 dirt_g_color;
uniform vec3 dirt_b_color;
float shadow_func (in float x, in float y, in float noise, in float dist);
// uniform mat4 osg_ViewMatrixInverse;
// uniform mat4 osg_ViewMatrix;
@ -246,9 +249,14 @@ void main (void)
else
pf = pow(nDotHV, gl_FrontMaterial.shininess);
//vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP;
vec3 relPos;
if (cloud_shadow_flag == 1)
{
relPos = (gl_ModelViewMatrixInverse * vec4 (vertVec,0.0)).xyz;
light_diffuse = light_diffuse * shadow_func(relPos.x, relPos.y, 1.0, dist);
}
vec4 Diffuse = light_diffuse * nDotVP;
//vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].specular * pf;
vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf;
vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse;

View file

@ -50,6 +50,7 @@ uniform float fogstructure;
uniform float cloud_self_shading;
uniform vec3 night_color;
uniform bool random_buildings;
uniform int cloud_shadow_flag;
const float scale = 1.0;
int linear_search_steps = 10;
@ -62,6 +63,7 @@ const float terminator_width = 200000.0;
float alt;
float eShade;
float shadow_func (in float x, in float y, in float noise, in float dist);
float rand2D(in vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
@ -342,6 +344,12 @@ void main (void)
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float dist = length(relPos);
if (cloud_shadow_flag == 1)
{diffuse = diffuse * shadow_func(relPos.x, relPos.y, 1.0, dist);}
float shadow_factor = 1.0;
// Shadow
@ -403,7 +411,7 @@ if (quality_level > 2)
// here comes the terrain haze model
float dist = length(relPos);
float delta_z = hazeLayerAltitude - eye_alt;