mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
minnaert reflection model
This commit is contained in:
parent
81afa5716c
commit
ea57679d92
26
src/meshlab/shaders/minnaert.frag
Normal file
26
src/meshlab/shaders/minnaert.frag
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// Minnaert reflection model (per-pixel)
|
||||
//
|
||||
// by
|
||||
// Massimiliano Corsini
|
||||
// Visual Computing Lab (2006)
|
||||
//
|
||||
|
||||
varying vec3 normal;
|
||||
varying vec3 vpos;
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 N = normalize(normal);
|
||||
vec3 V = normalize(-vpos);
|
||||
vec3 L = normalize(gl_LightSource[0].position.xyz - vpos);
|
||||
|
||||
// diffuse color
|
||||
vec4 kd = gl_LightSource[0].diffuse * gl_FrontMaterial.diffuse;
|
||||
|
||||
// Minnaert reflection model
|
||||
float NdotV = dot(N,V);
|
||||
float NdotL = dot(N,L);
|
||||
|
||||
gl_FragColor = max(0.0, NdotV * NdotL) * kd;
|
||||
}
|
||||
46
src/meshlab/shaders/minnaert.gdp
Normal file
46
src/meshlab/shaders/minnaert.gdp
Normal 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=".\minnaert.vert" />
|
||||
</Filenames>
|
||||
</VPCount>
|
||||
<FPCount numero="1">
|
||||
<Filenames>
|
||||
<Filename0 FragmentProgram=".\minnaert.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="False" 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="True" />
|
||||
<BuiltInStates>
|
||||
<ModelAmbient AmbientR="0" AmbientG="0" AmbientB="0" AmbientA="1" />
|
||||
<FrontMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.9450981" DifG="0.937255" DifB="0.8862746" DifA="1" SpecR="1" SpecG="1" SpecB="1" SpecA="1" EmiR="0" EmiG="0" EmiB="0" EmiA="1" Shininess="10" />
|
||||
<BackMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0" DifG="0" DifB="0" 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>
|
||||
22
src/meshlab/shaders/minnaert.vert
Normal file
22
src/meshlab/shaders/minnaert.vert
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Minnaert reflection model (per-pixel)
|
||||
//
|
||||
// by
|
||||
// Massimiliano Corsini
|
||||
// Visual Computing Lab (2006)
|
||||
//
|
||||
|
||||
varying vec3 normal;
|
||||
varying vec3 vpos;
|
||||
|
||||
void main (void)
|
||||
{
|
||||
// vertex normal
|
||||
normal = gl_NormalMatrix * gl_Normal;
|
||||
|
||||
// vertex position (in eye-space)
|
||||
vpos = vec3(gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user