Change default effects attached to terrain and models
Add a technique that initialize the buffers of the Rembrandt renderer (use Multi Render Target) Renumber techniques that depends on old technique 10 (now 11) of model-default
This commit is contained in:
parent
4334e98e1d
commit
c4390ae31a
7 changed files with 178 additions and 6 deletions
|
@ -492,7 +492,7 @@
|
|||
<!-- END fog include -->
|
||||
</pass>
|
||||
</technique>
|
||||
<technique n="10">
|
||||
<technique n="11"> <!-- FIXME: this technique number overlaps the one in model-default -->
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shaders/water</property>
|
||||
|
|
|
@ -34,7 +34,7 @@ in Aircraft/A320/Models/Effects/a320_bumpspec.eff ( or whatever, private to the
|
|||
<tangent type="int">6</tangent>
|
||||
<binormal type="int">7</binormal>
|
||||
</generate>
|
||||
<technique n="10">
|
||||
<technique n="11"> <!-- This number should be the same than the second technique in model-default -->
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shaders/model</property>
|
||||
|
|
|
@ -148,7 +148,7 @@ please see Docs/README.model-combined.eff for documentation
|
|||
<binormal type="int">7</binormal>
|
||||
</generate>-->
|
||||
|
||||
<technique n="10">
|
||||
<technique n="11"> <!-- FIXME: this technique number overlaps the one in model-default -->
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shaders/model</property>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<color-mode-uniform>1</color-mode-uniform>
|
||||
<!-- DIFFUSE -->
|
||||
</material>
|
||||
<material-id>0</material-id>
|
||||
<!-- BEGIN fog include -->
|
||||
<visibility>
|
||||
<use>/environment/ground-visibility-m</use>
|
||||
|
@ -131,7 +132,75 @@
|
|||
</pass>
|
||||
</technique>
|
||||
|
||||
<technique n="10">
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/rembrandt</property>
|
||||
<or>
|
||||
<less-equal>
|
||||
<value type="float">2.0</value>
|
||||
<glversion/>
|
||||
</less-equal>
|
||||
<and>
|
||||
<extension-supported>GL_ARB_shader_objects</extension-supported>
|
||||
<extension-supported>GL_ARB_shading_language_100</extension-supported>
|
||||
<extension-supported>GL_ARB_vertex_shader</extension-supported>
|
||||
<extension-supported>GL_ARB_fragment_shader</extension-supported>
|
||||
</and>
|
||||
</or>
|
||||
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
|
||||
<extension-supported>GL_ARB_texture_rg</extension-supported>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass>
|
||||
<lighting>false</lighting>
|
||||
<material>
|
||||
<ambient><use>material/ambient</use></ambient>
|
||||
<diffuse><use>material/diffuse</use></diffuse>
|
||||
<specular><use>material/specular</use></specular>
|
||||
<emissive><use>material/emissive</use></emissive>
|
||||
<shininess><use>material/shininess</use></shininess>
|
||||
<color-mode>ambient-and-diffuse</color-mode>
|
||||
</material>
|
||||
<blend>false</blend>
|
||||
<alpha-test>true</alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<cull-face>back</cull-face>
|
||||
<render-bin>
|
||||
<bin-number>1</bin-number>
|
||||
<bin-name>RenderBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<image><use>texture[0]/image</use></image>
|
||||
<filter><use>texture[0]/filter</use></filter>
|
||||
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[0]/internal-format</use>
|
||||
</internal-format>
|
||||
<environment>
|
||||
<mode>modulate</mode>
|
||||
</environment>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/deferred-gbuffer.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/deferred-gbuffer.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<!-- uniform>
|
||||
<name>materialID</name>
|
||||
<type>int</type>
|
||||
<value><use>material-id</use></value>
|
||||
</uniform -->
|
||||
</pass>
|
||||
</technique>
|
||||
|
||||
<technique n="11">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shaders/generic</property>
|
||||
|
@ -290,7 +359,7 @@
|
|||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
<technique n="11">
|
||||
<technique n="12">
|
||||
<pass>
|
||||
<lighting>true</lighting>
|
||||
<material>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<bin-number>0</bin-number>
|
||||
<bin-name>RenderBin</bin-name>
|
||||
</render-bin>
|
||||
<material-id>0</material-id>
|
||||
<visibility><use>/environment/ground-visibility-m</use></visibility>
|
||||
<avisibility><use>/environment/visibility-m</use></avisibility>
|
||||
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
|
||||
|
@ -195,6 +196,74 @@
|
|||
</technique>
|
||||
|
||||
<technique n="10">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/rembrandt</property>
|
||||
<or>
|
||||
<less-equal>
|
||||
<value type="float">2.0</value>
|
||||
<glversion/>
|
||||
</less-equal>
|
||||
<and>
|
||||
<extension-supported>GL_ARB_shader_objects</extension-supported>
|
||||
<extension-supported>GL_ARB_shading_language_100</extension-supported>
|
||||
<extension-supported>GL_ARB_vertex_shader</extension-supported>
|
||||
<extension-supported>GL_ARB_fragment_shader</extension-supported>
|
||||
</and>
|
||||
</or>
|
||||
<extension-supported>GL_EXT_gpu_shader4</extension-supported>
|
||||
<extension-supported>GL_ARB_texture_rg</extension-supported>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass>
|
||||
<lighting>false</lighting>
|
||||
<material>
|
||||
<ambient><use>material/ambient</use></ambient>
|
||||
<diffuse><use>material/diffuse</use></diffuse>
|
||||
<specular><use>material/specular</use></specular>
|
||||
<emissive><use>material/emissive</use></emissive>
|
||||
<shininess><use>material/shininess</use></shininess>
|
||||
<color-mode>ambient-and-diffuse</color-mode>
|
||||
</material>
|
||||
<blend>false</blend>
|
||||
<alpha-test>true</alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<cull-face>back</cull-face>
|
||||
<render-bin>
|
||||
<bin-number>1</bin-number>
|
||||
<bin-name>RenderBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<image><use>texture[0]/image</use></image>
|
||||
<filter><use>texture[0]/filter</use></filter>
|
||||
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[0]/internal-format</use>
|
||||
</internal-format>
|
||||
<environment>
|
||||
<mode>modulate</mode>
|
||||
</environment>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/deferred-gbuffer.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/deferred-gbuffer.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<!-- uniform>
|
||||
<name>materialID</name>
|
||||
<type>int</type>
|
||||
<value><use>material-id</use></value>
|
||||
</uniform -->
|
||||
</pass>
|
||||
</technique>
|
||||
|
||||
<technique n="11">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shaders/generic</property>
|
||||
|
@ -394,7 +463,7 @@
|
|||
</technique>
|
||||
|
||||
|
||||
<technique n="11">
|
||||
<technique n="12">
|
||||
<pass>
|
||||
<lighting>true</lighting>
|
||||
<material>
|
||||
|
|
21
Shaders/deferred-gbuffer.frag
Normal file
21
Shaders/deferred-gbuffer.frag
Normal file
|
@ -0,0 +1,21 @@
|
|||
#extension GL_EXT_gpu_shader4 : enable
|
||||
//
|
||||
// attachment 0: normal.x | normal.x | normal.y | normal.y
|
||||
// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id
|
||||
// attachment 2: specular.l | shininess | emission.l | unused
|
||||
//
|
||||
varying vec3 ecNormal;
|
||||
varying vec4 color;
|
||||
uniform int materialID;
|
||||
uniform sampler2D texture;
|
||||
void main() {
|
||||
float specular = dot( gl_FrontMaterial.specular.rgb, vec3( 0.3, 0.59, 0.11 ) );
|
||||
float shininess = gl_FrontMaterial.shininess;
|
||||
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, vec3( 0.3, 0.59, 0.11 ) );
|
||||
vec4 texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
if (texel.a * color.a < 0.1)
|
||||
discard;
|
||||
gl_FragData[0] = vec4( ecNormal.xy, 0.0, 1.0 );
|
||||
gl_FragData[1] = vec4( color.rgb * texel.rgb, float( materialID ) / 255.0 );
|
||||
gl_FragData[2] = vec4( specular, shininess / 255.0, emission, 1.0 );
|
||||
}
|
13
Shaders/deferred-gbuffer.vert
Normal file
13
Shaders/deferred-gbuffer.vert
Normal file
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// attachment 0: normal.x | normal.x | normal.y | normal.y
|
||||
// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id
|
||||
// attachment 2: specular.l | shininess | emission.l | unused
|
||||
//
|
||||
varying vec3 ecNormal;
|
||||
varying vec4 color;
|
||||
void main() {
|
||||
ecNormal = gl_NormalMatrix * gl_Normal;
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
color = gl_Color;
|
||||
}
|
Loading…
Reference in a new issue