1
0
Fork 0

Remove intermediate quality settings from the ubershader. Fix a texture.

This commit is contained in:
Emilian Huminiuc 2014-01-15 23:26:26 +01:00 committed by Christian Schmitt
parent 830f8dacee
commit 7f183e0117
10 changed files with 128 additions and 159 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -546,14 +546,6 @@ the objects that use it, and replaces it with the default shader.
<use>ambient-correction</use>
</value>
</uniform>
<!-- shader quality -->
<uniform>
<name>shader_qual</name>
<type>int</type>
<value>
<use>shader-quality</use>
</value>
</uniform>
<uniform>
<name>hdg</name>

View file

@ -629,14 +629,6 @@ and fallback to plain transparency when the model shader is disabled.
<use>ambient-correction</use>
</value>
</uniform>
<!-- shader quality -->
<uniform>
<name>shader_qual</name>
<type>int</type>
<value>
<use>shader-quality</use>
</value>
</uniform>
<uniform>
<name>hdg</name>

View file

@ -109,10 +109,6 @@ please see Docs/README.model-combined.eff for documentation
<dirt-factor type="float" n="2">0.0</dirt-factor>
<!-- ambient correction -->
<ambient-correction type="float">0.05</ambient-correction>
<!-- quality slider -->
<shader-quality type="int">
<use>/sim/rendering/shaders/model</use>
</shader-quality>
<rendering-hint>opaque</rendering-hint>
<transparent>false</transparent>
<render-bin>
@ -712,14 +708,6 @@ please see Docs/README.model-combined.eff for documentation
<use>ambient-correction</use>
</value>
</uniform>
<!-- shader quality -->
<uniform>
<name>shader_qual</name>
<type>int</type>
<value>
<use>shader-quality</use>
</value>
</uniform>
<uniform>
<name>hdg</name>
@ -1353,14 +1341,6 @@ please see Docs/README.model-combined.eff for documentation
<use>ambient-correction</use>
</value>
</uniform>
<!-- shader quality -->
<uniform>
<name>shader_qual</name>
<type>int</type>
<value>
<use>shader-quality</use>
</value>
</uniform>
<uniform>
<name>hdg</name>

View file

@ -65,16 +65,19 @@ void main(void)
//normal = gl_NormalMatrix * normal;
VNormal = normalize(gl_NormalMatrix * normal);
if (nmap_enabled > 0 && shader_qual > 2){
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
} else {
VTangent = vec3(0.0);
VBinormal = vec3 (0.0);
}
vec3 n = normalize(normal);
vec3 t = cross(n, vec3(1.0,0.0,0.0));
vec3 b = cross(n,t);
vec3 tempTangent = cross(n, vec3(1.0,0.0,0.0));
vec3 tempBinormal = cross(n, tempTangent);
if (nmap_enabled > 0){
tempTangent = tangent;
tempBinormal = binormal;
}
VTangent = normalize(gl_NormalMatrix * tempTangent);
VBinormal = normalize(gl_NormalMatrix * tempBinormal);
vec3 t = tempTangent;
vec3 b = tempBinormal;
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work

View file

@ -3,6 +3,7 @@
// Authors: Frederic Bouvier and Gijs de Rooy
// with major additions and revisions by
// Emilian Huminiuc and Vivian Meazza 2011
#version 120
varying vec3 rawpos;
varying vec3 VNormal;
@ -27,7 +28,6 @@ uniform int refl_enabled;
uniform int refl_map;
uniform int lightmap_enabled;
uniform int lightmap_multi;
uniform int shader_qual;
uniform int dirt_enabled;
uniform int dirt_multi;
@ -80,7 +80,7 @@ void main (void)
float pf;
///BEGIN bump
if (nmap_enabled > 0 && shader_qual > 2){
if (nmap_enabled > 0){
N = nmap.rgb * 2.0 - 1.0;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
if (nmap_dds > 0)
@ -100,7 +100,7 @@ void main (void)
////////////////////////////////////////////////////////////////////
//BEGIN reflect
////////////////////////////////////////////////////////////////////
if (refl_enabled > 0 && shader_qual > 1){
if (refl_enabled > 0){
float reflFactor;
float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset
if(refl_map > 0){
@ -163,7 +163,7 @@ void main (void)
vec3 lightmapcolor;
vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor);
lightmapFactor = lightmapFactor * lightmapTexel;
if (lightmap_multi >0 ){
if (lightmap_multi > 0 ){
lightmapcolor = lightmap_r_color * lightmapFactor.r +
lightmap_g_color * lightmapFactor.g +
lightmap_b_color * lightmapFactor.b +

View file

@ -36,7 +36,6 @@ uniform int nmap_dds;
uniform int nmap_enabled;
uniform int refl_enabled;
uniform int refl_map;
uniform int shader_qual;
uniform int grain_texture_enabled;
uniform float amb_correction;
@ -218,7 +217,7 @@ void main (void)
/// END grain overlay
///BEGIN bump
if (nmap_enabled > 0 && shader_qual > 2){
if (nmap_enabled > 0){
N = nmap.rgb * 2.0 - 1.0;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
if (nmap_dds > 0)
@ -258,7 +257,7 @@ void main (void)
////////////////////////////////////////////////////////////////////
//BEGIN reflect
////////////////////////////////////////////////////////////////////
if (refl_enabled > 0 && shader_qual > 1){
if (refl_enabled > 0){
float reflFactor = 0.0;
float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset
@ -266,7 +265,7 @@ void main (void)
// map the shininess of the object with user input
//float pam = (map.a * -2) + 1; //reverse map
reflFactor = reflmap.a + transparency_offset;
} else if (nmap_enabled > 0 && shader_qual > 2) {
} else if (nmap_enabled > 0) {
// set the reflectivity proportional to shininess with user input
reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset;
} else {
@ -331,7 +330,7 @@ void main (void)
vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor,
lightmap_b_factor, lightmap_a_factor);
lightmapFactor = lightmapFactor * lightmapTexel;
if (lightmap_multi >0 ){
if (lightmap_multi > 0 ){
lightmapcolor = lightmap_r_color * lightmapFactor.r +
lightmap_g_color * lightmapFactor.g +
lightmap_b_color * lightmapFactor.b +

View file

@ -30,7 +30,6 @@ uniform int nmap_dds;
uniform int nmap_enabled;
uniform int refl_enabled;
uniform int refl_map;
uniform int shader_qual;
uniform float amb_correction;
uniform float dirt_b_factor;
@ -73,7 +72,7 @@ void main (void)
float pf = 0.0;
///BEGIN bump
if (nmap_enabled > 0 && shader_qual > 2){
if (nmap_enabled > 0 ){
N = nmap.rgb * 2.0 - 1.0;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
if (nmap_dds > 0)
@ -111,7 +110,7 @@ void main (void)
////////////////////////////////////////////////////////////////////
//BEGIN reflect
////////////////////////////////////////////////////////////////////
if (refl_enabled > 0 && shader_qual > 1){
if (refl_enabled > 0 ){
float reflFactor = 0.0;
float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset
@ -119,7 +118,7 @@ void main (void)
// map the shininess of the object with user input
//float pam = (map.a * -2) + 1; //reverse map
reflFactor = reflmap.a + transparency_offset;
} else if (nmap_enabled > 0 && shader_qual > 2) {
} else if (nmap_enabled > 0) {
// set the reflectivity proportional to shininess with user input
reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset;
} else {
@ -182,7 +181,7 @@ void main (void)
vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor,
lightmap_b_factor, lightmap_a_factor);
lightmapFactor = lightmapFactor * lightmapTexel;
if (lightmap_multi >0 ){
if (lightmap_multi > 0 ){
lightmapcolor = lightmap_r_color * lightmapFactor.r +
lightmap_g_color * lightmapFactor.g +
lightmap_b_color * lightmapFactor.b +

View file

@ -52,16 +52,20 @@ void main(void)
//fog_Func(fogType);
VNormal = normalize(gl_NormalMatrix * gl_Normal);
if (nmap_enabled > 0 && shader_qual > 2){
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
} else {
VTangent = vec3(0.0);
VBinormal = vec3 (0.0);
}
vec3 n = normalize(gl_Normal);
vec3 t = cross(n, vec3(1.0,0.0,0.0));
vec3 b = cross(n,t);
vec3 tempTangent = cross(n, vec3(1.0,0.0,0.0));
vec3 tempBinormal = cross(n, tempTangent);
if (nmap_enabled > 0){
tempTangent = tangent;
tempBinormal = binormal;
}
VTangent = normalize(gl_NormalMatrix * tempTangent);
VBinormal = normalize(gl_NormalMatrix * tempBinormal);
vec3 t = tempTangent;
vec3 b = tempBinormal;
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work

View file

@ -230,9 +230,9 @@
<slider>
<name>model</name>
<min>0.0</min>
<max>3.0</max>
<max>1.0</max>
<step>1.0</step>
<fraction>0.25</fraction>
<fraction>0.5</fraction>
<live>true</live>
<property>/sim/rendering/shaders/model</property>
<binding>