Skip to content

Commit

Permalink
Updated the balloon envelope shader to match the latest Rembrandt sha…
Browse files Browse the repository at this point in the history
…der.
  • Loading branch information
andgi committed Aug 3, 2012
1 parent 9515850 commit c2c369e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
10 changes: 3 additions & 7 deletions Models/Effects/balloon-envelope-gbuffer.frag
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
// Copyright (C) 2012 Anders Gidenstam (anders(at)gidenstam.org)
// This file is licensed under the GPL license version 2 or later.
//
// 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 float alpha;
Expand All @@ -20,6 +16,8 @@ uniform sampler2D texture;
varying vec3 ecTangent;
varying float pressureDelta, angle;//, looseness;

void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth);

void main() {
vec3 normal = normalize(ecNormal);
// Add some normal variation due to wrinkles.
Expand All @@ -38,7 +36,5 @@ void main() {
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, vec3( 0.3, 0.59, 0.11 ) );

vec3 normal2 = normalize( (2.0 * gl_Color.a - 1.0) * normal );
gl_FragData[0] = vec4( (normal2.xy + vec2(1.0,1.0)) * 0.5, 0.0, 1.0 );
gl_FragData[1] = vec4( gl_Color.rgb * texel.rgb, float( materialID ) / 255.0 );
gl_FragData[2] = vec4( specular, shininess / 255.0, emission, 1.0 );
encode_gbuffer(normal2, gl_Color.rgb * texel.rgb, materialID, specular, shininess, emission, gl_FragCoord.z);
}
4 changes: 0 additions & 4 deletions Models/Effects/balloon-envelope-gbuffer.vert
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
// Copyright (C) 2012 Anders Gidenstam (anders(at)gidenstam.org)
// This file is licensed under the GPL license version 2 or later.
//
// 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
//

// Balloon envelope specific constants.
uniform float gas_level_ft;
Expand Down
8 changes: 4 additions & 4 deletions Models/Effects/balloon-envelope.eff
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<property n="1">/sim/rendering/shaders/aircraft/balloon-envelope/quality-level</property>
</and>
</predicate>
<pass>
<program>
<pass n="0">
<program n="0">
<vertex-shader n="0">Aircraft/ZF_Navy_free_balloon/Models/Effects/balloon-envelope-gbuffer.vert</vertex-shader>
<fragment-shader n="0">Aircraft/ZF_Navy_free_balloon/Models/Effects/balloon-envelope-gbuffer.frag</fragment-shader>
</program>
Expand All @@ -35,8 +35,8 @@
<property n="0">/sim/rendering/shaders/aircraft/balloon-envelope/quality-level</property>
</and>
</predicate>
<pass>
<program>
<pass n="0">
<program n="0">
<vertex-shader n="1">Aircraft/ZF_Navy_free_balloon/Models/Effects/balloon-envelope.vert</vertex-shader>
<fragment-shader n="1">Aircraft/ZF_Navy_free_balloon/Models/Effects/balloon-envelope.frag</fragment-shader>
</program>
Expand Down

0 comments on commit c2c369e

Please sign in to comment.