1
0
Fork 0

Add material ID to provide increased specular effect in Rembrandt for water and ubershader.

Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
Emilian Huminiuc 2012-06-26 02:12:29 +03:00
parent ce18b24ba9
commit f6b74fc128
7 changed files with 23 additions and 3 deletions

View file

@ -73,6 +73,11 @@ void main() {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0);
// gl_FragColor = mix(tint, vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0), 0.92);
}

View file

@ -33,5 +33,10 @@ void main() {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 255.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(Idiff + Ispec + Iemis, 1.0);
}

View file

@ -69,6 +69,11 @@ void main() {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0);
// gl_FragColor = mix(tint, vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0), 0.92);
}

View file

@ -91,6 +91,11 @@ void main() {
halfDir /= len;
Ispec = pow( clamp( dot( halfDir, normal ), 0.0, 1.0 ), spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb;
}
float matID = texture2D( color_tex, coords ).a * 255.0;
if (matID == 255.0)
Idiff += Ispec * spec_emis.x;
gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0);
// gl_FragColor = mix(tint, vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0), 0.92);
}

View file

@ -184,5 +184,5 @@ void main (void)
// END lightmap
/////////////////////////////////////////////////////////////////////
encode_gbuffer(N, fragColor.rgb, 1, specular, gl_FrontMaterial.shininess, emission, gl_FragCoord.z);
encode_gbuffer(N, fragColor.rgb, 255, specular, gl_FrontMaterial.shininess, emission, gl_FragCoord.z);
}

View file

@ -199,5 +199,5 @@ void main(void)
vec3( 0.3, 0.59, 0.11 )
);
float specular = smoothstep(0.0, 3.5, cover);
encode_gbuffer(Normal, finalColor.rgb, 1, specular, 128, emission, gl_FragCoord.z);
encode_gbuffer(Normal, finalColor.rgb, 255, specular, 128, emission, gl_FragCoord.z);
}

View file

@ -379,5 +379,5 @@ void main(void)
vec3( 0.3, 0.59, 0.11 )
);
float specular = smoothstep(0.0, 3.5, cover);
encode_gbuffer(Normal, finalColor.rgb, 1, specular, water_shininess, emission, gl_FragCoord.z);
encode_gbuffer(Normal, finalColor.rgb, 255, specular, water_shininess, emission, gl_FragCoord.z);
}