no message

This commit is contained in:
Paolo Cignoni cignoni 2006-03-21 00:03:46 +00:00
parent 467137edc2
commit 0fa4227e89
7 changed files with 169 additions and 1 deletions

View File

@ -0,0 +1,4 @@
void main()
{
gl_FragColor = gl_Color;
}

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<GLSLang>
<Metadata>
<Author Author="" />
<Email Email="" />
<Company Company="" />
<Shader Shader="" />
<ShaderDescription ShaderDescription="" />
<License License="" />
<Version Version="" />
</Metadata>
<VPCount numero="1">
<Filenames>
<Filename0 VertexProgram=".\Cook-Torrance.vert" />
</Filenames>
</VPCount>
<FPCount numero="1">
<Filenames>
<Filename0 FragmentProgram=".\Cook-Torrance.frag" />
</Filenames>
</FPCount>
<TexturesPlugins NumberOfPlugins="0" />
<TexturedUsed NumberUsedTU="0" />
<UniformVariables NumberOfVariables="0" />
<FogParameters FogColorR="0" FogColorG="0" FogColorB="0" FogColorA="1" Density="1" Start="0" End="1" />
<VertexProcessor CullFace="True" PolygonMode="DummieField" PolygonModeBack="6914" PolygonModeFront="6914" LocalValue="1" TwoSidedValue="0" ColorControlValue="33273" />
<FragmentProcessor Shade="7425" AlphaTest="False" AlphaFunc="516" AlphaClamp="0.5" Blending="False" BlendFuncSRC="770" BlendFuncDST="771" BlendEquation="32774" DepthTest="True" DepthFunc="515" ClampNear="0" ClampFar="1" ClearColorR="0.5019608" ClearColorG="0.5019608" ClearColorB="0.5019608" ClearColorA="1" />
<MotionData Speed="0.05" Distance="4" Rotation="False" />
<BuiltInStates>
<ModelAmbient AmbientR="0.2" AmbientG="0.2" AmbientB="0.2" AmbientA="1" />
<FrontMaterial AmbR="0.8274511" AmbG="0.8274511" AmbB="0.8274511" AmbA="1" DifR="0.5019608" DifG="0.5019608" DifB="0.5019608" DifA="1" SpecR="1" SpecG="1" SpecB="1" SpecA="1" EmiR="1" EmiG="1" EmiB="1" EmiA="1" Shininess="0" />
<BackMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.8000001" DifG="0.8000001" DifB="0.8000001" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" EmiR="0" EmiG="0" EmiB="0" EmiA="1" Shininess="0" />
<PointParameters Size="1" MinSize="0" MaxSize="1" Threshold="1" ConstantAttenuation="1" LinearAttenuation="0" QuadraticAttenuation="0" />
<Light0 Enabled="True" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="1" AmbG="1" AmbB="1" AmbA="1" DifR="1" DifG="1" DifB="1" DifA="1" SpecR="1" SpecG="1" SpecB="1" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light1 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light2 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light3 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light4 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light5 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light6 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light7 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
</BuiltInStates>
<BackGround>
<BackGroundMode Mode="0" />
</BackGround>
</GLSLang>

View File

@ -0,0 +1,35 @@
void main()
{
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
vec3 LightVector = vec3(gl_LightSource[0].position);
vec3 VertexToEye = normalize(vec3(2.0 * gl_LightSource[0].halfVector - gl_LightSource[0].position));
vec3 HalfVector = vec3(gl_LightSource[0].halfVector);
float NdotH = max(0.0, dot(normal, HalfVector));
vec3 RoughnessParams = vec3(0.5, 0.5, 0.5);
//Start the "D" term, use Blinn Gaussian
float Alpha = acos(NdotH);
float C = RoughnessParams.x;
float m = RoughnessParams.y;
float D = C * exp(-(pow(Alpha / m, 2.0)));
//Start the "G" term
float NdotV = dot(normal, VertexToEye);
float VdotH = dot(HalfVector, VertexToEye);
float NdotL = dot(LightVector, normal);
float G1 = 2.0 * NdotH * NdotV / NdotH;
float G2 = 2.0 * NdotH * NdotL / NdotH;
float G = min(1.0, max(0.0, min(G1, G2)));
//Start the fresnel term. Use the approximation from
//http://developer.nvidia.com/docs/IO/3035/ATT/FresnelReflection.pdf
float R0 = RoughnessParams.z;
float F = R0 + (1.0 - R0) * pow(1.0 - NdotL, 5.0);
vec4 DiffuseColor = gl_FrontMaterial.diffuse;
gl_FrontColor = DiffuseColor * F * D * G / (NdotL * NdotV);
gl_Position = ftransform();
}

View File

@ -0,0 +1,4 @@
void main()
{
gl_FragColor = gl_Color;
}

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<GLSLang>
<Metadata>
<Author Author="" />
<Email Email="" />
<Company Company="" />
<Shader Shader="" />
<ShaderDescription ShaderDescription="" />
<License License="" />
<Version Version="" />
</Metadata>
<VPCount numero="1">
<Filenames>
<Filename0 VertexProgram=".\Oren-Nayar.vert" />
</Filenames>
</VPCount>
<FPCount numero="1">
<Filenames>
<Filename0 FragmentProgram=".\Oren-Nayar.frag" />
</Filenames>
</FPCount>
<TexturesPlugins NumberOfPlugins="0" />
<TexturedUsed NumberUsedTU="0" />
<UniformVariables NumberOfVariables="0" />
<FogParameters FogColorR="0" FogColorG="0" FogColorB="0" FogColorA="1" Density="1" Start="0" End="1" />
<VertexProcessor CullFace="True" PolygonMode="DummieField" PolygonModeBack="6914" PolygonModeFront="6914" LocalValue="1" TwoSidedValue="0" ColorControlValue="33273" />
<FragmentProcessor Shade="7425" AlphaTest="False" AlphaFunc="516" AlphaClamp="0.5" Blending="False" BlendFuncSRC="770" BlendFuncDST="771" BlendEquation="32774" DepthTest="True" DepthFunc="515" ClampNear="0" ClampFar="1" ClearColorR="0.5019608" ClearColorG="0.5019608" ClearColorB="0.5019608" ClearColorA="1" />
<MotionData Speed="0.05" Distance="2" Rotation="False" />
<BuiltInStates>
<ModelAmbient AmbientR="0.2" AmbientG="0.2" AmbientB="0.2" AmbientA="1" />
<FrontMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.7215686" DifG="0.5254902" DifB="0.04313726" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" EmiR="0" EmiG="0" EmiB="0" EmiA="1" Shininess="0" />
<BackMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.8000001" DifG="0.8000001" DifB="0.8000001" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" EmiR="0" EmiG="0" EmiB="0" EmiA="1" Shininess="0" />
<PointParameters Size="1" MinSize="0" MaxSize="1" Threshold="1" ConstantAttenuation="1" LinearAttenuation="0" QuadraticAttenuation="0" />
<Light0 Enabled="True" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="1" DifG="1" DifB="1" DifA="1" SpecR="1" SpecG="1" SpecB="1" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light1 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light2 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light3 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light4 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light5 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light6 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
<Light7 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
</BuiltInStates>
<BackGround>
<BackGroundMode Mode="0" />
</BackGround>
</GLSLang>

View File

@ -0,0 +1,31 @@
void main()
{
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
vec3 LightVector = vec3(gl_LightSource[0].position);
vec3 VertexToEye = normalize(vec3(2.0 * gl_LightSource[0].halfVector - gl_LightSource[0].position));
float VdotN = dot(VertexToEye, normal);
float LdotN = dot(LightVector, normal);
float Irradiance = max(0.0, LdotN);
float AngleViewNormal = acos(VdotN);
float AngleLightNormal = acos(LdotN);
float AngleDifference = max (0.0, dot(normalize(VertexToEye - normal * VdotN),
normalize(LightVector - normal * LdotN)));
float Alpha = max(AngleViewNormal, AngleLightNormal);
float Beta = min(AngleViewNormal, AngleLightNormal);
vec4 DiffuseColor = gl_FrontMaterial.diffuse;
float RoughnessSquared = 0.5;
float A = 1.0 - (0.5 * RoughnessSquared) / (RoughnessSquared + 0.33);
float B = (0.45 * RoughnessSquared) / (RoughnessSquared + 0.09);
gl_FrontColor = DiffuseColor * (A + B * AngleDifference * sin(Alpha) * tan(Beta)) * Irradiance;
gl_Position = ftransform();
}

View File

@ -1,10 +1,12 @@
void main()
{
vec3 normal, lightDir, viewVector, rVector;
vec4 diffuse, ambient, globalAmbient, specular = vec4(0.0);
normal = normalize(gl_NormalMatrix * gl_Normal);
lightDir = normalize(vec3(gl_LightSource[0].position));
viewVector = normalize(vec3(2.0 * gl_LightSource[0].halfVector - gl_LightSource[0].position));
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
globalAmbient = gl_LightModel.ambient * gl_FrontMaterial.ambient;
@ -15,4 +17,4 @@ void main()
gl_FrontColor = globalAmbient + dot(normal, lightDir) * diffuse + ambient + specular;
gl_Position = ftransform();
}
}