1
0
Fork 0

Improved Random building texturesa - Gabo Huerta

Improved textures, lightmaps from Gabo Huerta.
Improved interaction with the urban shader from Thorsten Renk.
This commit is contained in:
Stuart Buchanan 2013-12-28 20:36:49 +00:00
parent 2b6964911f
commit b2f261ea0a
6 changed files with 110 additions and 81 deletions

View file

@ -7,11 +7,13 @@
<use>/environment/snow-level-m</use>
</snow-level>
<depth-factor type="float">0.008</depth-factor>
<night-color type="vec3d">0.75 0.59 0.05</night-color>
<night-color type="vec3d">1 1 0.50</night-color>
<random-buildings type="bool">
<use>/sim/rendering/random-buildings</use>
</random-buildings>
<quality-level>
<use>/sim/rendering/shaders/urban</use>
</quality-level>
<!--fog include-->
<visibility>
<use>/environment/ground-visibility-m</use>
@ -32,7 +34,6 @@
<use>/sim/rendering/shaders/skydome</use>
</fogtype>
<!-- END fog include -->
</parameters>
<generate>
<normal type="int">15</normal>
@ -41,8 +42,6 @@
</generate>
<technique n="1">
<predicate>
<and>
@ -52,10 +51,6 @@
<value type="float">4.0</value>
<float-property>/sim/rendering/shaders/urban</float-property>
</less-equal>
<equal>
<property>/sim/rendering/random-buildings</property>
<value type="bool">false</value>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -111,7 +106,7 @@
<use>texture[0]/image</use>
</image>
<type>
<use>texture[0]/type</use>
<use>texture[0]/type</use>
</type>
<filter>
<use>texture[0]/filter</use>
@ -132,7 +127,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
@ -153,7 +148,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>nearest-mipmap-nearest</filter>
<wrap-s>
@ -255,6 +250,13 @@
<use>max-lod-level</use>
</value>
</uniform>
<uniform>
<name>random_buildings</name>
<type>bool</type>
<value type="bool">
<use>random-buildings</use>
</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
@ -356,10 +358,6 @@
<value type="float">1.0</value>
<float-property>/sim/rendering/shaders/urban</float-property>
</less-equal>
<equal>
<property>/sim/rendering/random-buildings</property>
<value type="bool">false</value>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -411,7 +409,7 @@
<use>texture[0]/image</use>
</image>
<type>
<use>texture[0]/type</use>
<use>texture[0]/type</use>
</type>
<filter>
<use>texture[0]/filter</use>
@ -432,7 +430,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
@ -544,8 +542,7 @@
<name>fogstructure</name>
<type>float</type>
<value><use>fogstructure</use></value>
</uniform>
</uniform>
<!-- END fog include -->
<uniform>
@ -609,7 +606,13 @@
<value><use>moonlight</use></value>
</uniform>
<uniform>
<name>random_buildings</name>
<type>bool</type>
<value type="bool">
<use>random-buildings</use>
</value>
</uniform>
</pass>
</technique>
@ -624,10 +627,6 @@
<value type="float">4.0</value>
<float-property>/sim/rendering/shaders/urban</float-property>
</less-equal>
<equal>
<property>/sim/rendering/random-buildings</property>
<value type="bool">false</value>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -675,7 +674,7 @@
<use>texture[0]/image</use>
</image>
<type>
<use>texture[0]/type</use>
<use>texture[0]/type</use>
</type>
<filter>
<use>texture[0]/filter</use>
@ -696,7 +695,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
@ -813,6 +812,13 @@
<use>max-lod-level</use>
</value>
</uniform>
<uniform>
<name>random_buildings</name>
<type>bool</type>
<value type="bool">
<use>random-buildings</use>
</value>
</uniform>
</pass>
</technique>
<technique n="7">
@ -824,10 +830,6 @@
<value type="float">1.0</value>
<float-property>/sim/rendering/shaders/urban</float-property>
</less-equal>
<equal>
<property>/sim/rendering/random-buildings</property>
<value type="bool">false</value>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -871,7 +873,7 @@
<use>texture[0]/image</use>
</image>
<type>
<use>texture[0]/type</use>
<use>texture[0]/type</use>
</type>
<filter>
<use>texture[0]/filter</use>
@ -892,7 +894,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
@ -979,6 +981,13 @@
<use>snow-level</use>
</value>
</uniform>
<uniform>
<name>random_buildings</name>
<type>bool</type>
<value type="bool">
<use>random-buildings</use>
</value>
</uniform>
</pass>
</technique>
<technique n="8">
@ -990,10 +999,6 @@
<value type="float">4.0</value>
<float-property>/sim/rendering/shaders/urban</float-property>
</less-equal>
<equal>
<property>/sim/rendering/random-buildings</property>
<value type="bool">false</value>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -1049,7 +1054,7 @@
<use>texture[0]/image</use>
</image>
<type>
<use>texture[0]/type</use>
<use>texture[0]/type</use>
</type>
<filter>
<use>texture[0]/filter</use>
@ -1070,7 +1075,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
@ -1194,6 +1199,13 @@
<use>max-lod-level</use>
</value>
</uniform>
<uniform>
<name>random_buildings</name>
<type>bool</type>
<value type="bool">
<use>random-buildings</use>
</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
@ -1249,10 +1261,6 @@
<value type="float">1.0</value>
<float-property>/sim/rendering/shaders/urban</float-property>
</less-equal>
<equal>
<property>/sim/rendering/random-buildings</property>
<value type="bool">false</value>
</equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -1304,7 +1312,7 @@
<use>texture[0]/image</use>
</image>
<type>
<use>texture[0]/type</use>
<use>texture[0]/type</use>
</type>
<filter>
<use>texture[0]/filter</use>
@ -1325,7 +1333,7 @@
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
@ -1456,8 +1464,6 @@
<use>snow-level</use>
</value>
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -31,6 +31,7 @@ uniform float depth_factor;
uniform float tile_size;
uniform float quality_level;
uniform float snowlevel;
uniform bool random_buildings;
const float scale = 1.0;
int linear_search_steps = 10;
@ -153,7 +154,9 @@ float ray_intersect_relief(vec2 dp, vec2 ds)
float ray_intersect(vec2 dp, vec2 ds)
{
if ( quality_level >= 4.0 )
if ( random_buildings )
return 0.0;
else if ( quality_level >= 4.0 )
return ray_intersect_QDM( dp, ds );
else
return ray_intersect_relief( dp, ds );
@ -164,13 +167,18 @@ void main (void)
if ( quality_level >= 3.0 ) {
linear_search_steps = 20;
}
float depthfactor = depth_factor;
if ( random_buildings )
depthfactor = 0.0;
vec3 normal = normalize(VNormal);
vec3 tangent = normalize(VTangent);
vec3 binormal = normalize(VBinormal);
vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
vec3 V = normalize(ecPos3);
vec3 s = vec3(dot(V, tangent), dot(V, binormal), dot(normal, -V));
vec2 ds = s.xy * depth_factor / s.z;
vec2 ds = s.xy * depthfactor / s.z;
vec2 dp = gl_TexCoord[0].st - ds;
float d = ray_intersect(dp, ds);
@ -206,7 +214,7 @@ void main (void)
// step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
// finalColor *= ambient_light;
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 );
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 );
if (dot(normal,-V) > 0.1) {
vec4 iproj = gl_ProjectionMatrix * p;

View file

@ -49,6 +49,7 @@ uniform float wetness;
uniform float fogstructure;
uniform float cloud_self_shading;
uniform vec3 night_color;
uniform bool random_buildings;
const float scale = 1.0;
int linear_search_steps = 10;
@ -299,7 +300,9 @@ float ray_intersect_relief(vec2 dp, vec2 ds)
float ray_intersect(vec2 dp, vec2 ds)
{
if ( quality_level >= 4.0 )
if ( random_buildings )
return 0.0;
else if ( quality_level >= 4.0 )
return ray_intersect_QDM( dp, ds );
else
return ray_intersect_relief( dp, ds );
@ -310,6 +313,11 @@ void main (void)
if ( quality_level >= 3.0 ) {
linear_search_steps = 20;
}
float depthfactor = depth_factor;
if ( random_buildings )
depthfactor = 0.0;
vec3 shadedFogColor = vec3(0.65, 0.67, 0.78);
float effective_scattering = min(scattering, cloud_self_shading);
vec3 normal = normalize(VNormal);
@ -319,7 +327,7 @@ void main (void)
vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
vec3 V = normalize(ecPos3);
vec3 s = vec3(dot(V, tangent), dot(V, binormal), dot(normal, -V));
vec2 ds = s.xy * depth_factor / s.z;
vec2 ds = s.xy * depthfactor / s.z;
vec2 dp = gl_TexCoord[0].st - ds;
float d = ray_intersect(dp, ds);
@ -340,7 +348,7 @@ void main (void)
if ( quality_level >= 2.0 ) {
dp += ds * d;
vec3 sl = normalize( vec3( dot( l, tangent ), dot( l, binormal ), dot( -l, normal ) ) );
ds = sl.xy * depth_factor / sl.z;
ds = sl.xy * depthfactor / sl.z;
dp -= ds * d;
float dl = ray_intersect(dp, ds);
if ( dl < d - 0.05 )
@ -388,7 +396,7 @@ if (quality_level > 2)
finalColor *= ambient_light;
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 );
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 );
//finalColor.rgb = fog_Func(finalColor.rgb, fogType);

View file

@ -31,6 +31,7 @@ uniform float tile_size;
uniform float quality_level;
uniform float snowlevel;
uniform vec3 night_color;
uniform bool random_buildings;
const float scale = 1.0;
int linear_search_steps = 10;
@ -156,7 +157,9 @@ float ray_intersect_relief(vec2 dp, vec2 ds)
float ray_intersect(vec2 dp, vec2 ds)
{
if ( quality_level >= 4.0 )
if ( random_buildings )
return 0.0;
else if ( quality_level >= 4.0 )
return ray_intersect_QDM( dp, ds );
else
return ray_intersect_relief( dp, ds );
@ -167,6 +170,10 @@ void main (void)
if ( quality_level >= 3.0 ) {
linear_search_steps = 20;
}
float depthfactor = depth_factor;
if ( random_buildings ) depthfactor = 0.0;
vec3 normal = normalize(VNormal);
vec3 tangent = normalize(VTangent);
//vec3 binormal = normalize(VBinormal);
@ -174,7 +181,7 @@ void main (void)
vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
vec3 V = normalize(ecPos3);
vec3 s = vec3(dot(V, tangent), dot(V, binormal), dot(normal, -V));
vec2 ds = s.xy * depth_factor / s.z;
vec2 ds = s.xy * depthfactor / s.z;
vec2 dp = gl_TexCoord[0].st - ds;
float d = ray_intersect(dp, ds);
@ -195,7 +202,7 @@ void main (void)
if ( quality_level >= 2.0 ) {
dp += ds * d;
vec3 sl = normalize( vec3( dot( l, tangent ), dot( l, binormal ), dot( -l, normal ) ) );
ds = sl.xy * depth_factor / sl.z;
ds = sl.xy * depthfactor / sl.z;
dp -= ds * d;
float dl = ray_intersect(dp, ds);
if ( dl < d - 0.05 )
@ -232,7 +239,7 @@ void main (void)
step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
finalColor *= ambient_light;
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 );
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 );
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 KiB

After

Width:  |  Height:  |  Size: 381 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 KiB

After

Width:  |  Height:  |  Size: 2.7 MiB