Commit ab95ff41 authored by Christopher Tenter's avatar Christopher Tenter

remove old ward shader refs #2068

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18443 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 88f115dc
varying vec4 diffuse_color;
varying vec3 normal;
varying vec4 vertexPosition;
uniform float ward_specular;
uniform float ward_diffuse;
uniform float ward_alpha;
const float pi = 3.141592653589793238;
const float pi_rec = 0.3183098861837906715;
/** \brief Isotropic Ward BRDF.
*/
vec4 ward_direct(int lightSource)
{
vec3 light_pos = vec3(gl_LightSource[lightSource].position);
vec3 vtx_pos = vec3(vertexPosition / vertexPosition.w);
vec3 i = vec3(light_pos - vtx_pos);
float lightDistance = length(i);
i /= lightDistance;
vec4 color = vec4(0.0);
vec3 n;
n = normalize(normal);
float NdotI = dot(n, i);
float IdotD = dot(-i, gl_LightSource[lightSource].spotDirection);
if (NdotI > 0.0 && IdotD > 0.0)
{
vec3 o = normalize(-vtx_pos);
vec3 h = normalize(i + o);
float NdotO = dot(n, o);
float G = (IdotD * NdotI);
float HdotN = dot(h, n);
vec4 f_R = vec4( ward_diffuse * pi_rec + (ward_specular * exp((HdotN * HdotN - 1.0) / (HdotN * HdotN * ward_alpha * ward_alpha)))
/ (4.0 * pi * ward_alpha * ward_alpha * sqrt(NdotI * NdotO)) );
color = gl_LightSource[lightSource].diffuse * f_R * G;
}
//use Alpha value from original object color
color[3] = diffuse_color[3];
return color;
}
void main() {
gl_FragColor = ward_direct(0);
}
varying vec4 diffuse_color;
varying vec3 normal;
varying vec4 vertexPosition;
uniform float ward_specular;
uniform float ward_diffuse;
uniform float ward_alpha;
void main()
{
normal = normalize(gl_NormalMatrix * gl_Normal);
vertexPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * vertexPosition;
diffuse_color = gl_FrontMaterial.diffuse;
}
[FragmentShader]
file=Fragment.glsl
[Info]
name=Ward Shader
uniformTypes=float;float;float
uniforms=ward_specular;ward_diffuse;ward_alpha
uniformsDefault=0.5;3.0;0.2
uniformsMax=1.0;4.0;1.0
uniformsMin=0.0;0.0;0.0
version=1.0
[VertexShader]
file=Vertex.glsl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment