mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-15 17:14:39 +00:00
Added new parameters to reflexion lines shader (thanks to Simon Boye' for submitting the patches)
This commit is contained in:
parent
ebcf48ba55
commit
873ee8557f
@ -31,6 +31,11 @@ varying vec3 Normal;
|
||||
|
||||
uniform float ScaleFactor;
|
||||
uniform float Smoothing;
|
||||
uniform float Shading;
|
||||
|
||||
float arcSinus(float x) {
|
||||
return x * (1 + x*x * ((1.0/6.0) + x*x * ((3.0/40.0) + (15.0/336.0)*x*x)));
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
@ -44,8 +49,14 @@ void main (void)
|
||||
reflexionVector.z = 0.5/sqrt(dot(reflexionVector,reflexionVector));
|
||||
reflexionVector.xy = (reflexionVector.xy*reflexionVector.z) + 0.5;
|
||||
reflexionVector *= 2.0;
|
||||
color = vec4(clamp(0.5 + Smoothing * sin(2.0 * 3.1428 * reflexionVector.x*ScaleFactor), 0.0, 1.0));
|
||||
|
||||
// color = vec4(clamp(0.5 + Smoothing * sin(2.0 * 3.1428 * reflexionVector.x*ScaleFactor), 0.0, 1.0),
|
||||
// clamp(0.5 + Smoothing * sin(2.0 * 3.1428 * reflexionVector.y*ScaleFactor), 0.0, 1.0),
|
||||
// clamp(0.5 + Smoothing * sin(2.0 * 3.1428 * reflexionVector.z*ScaleFactor), 0.0, 1.0),
|
||||
// 1.0);
|
||||
|
||||
float sharpness = 1.0/arcSinus(Smoothing*fwidth(reflexionVector.x)*2.0*ScaleFactor);
|
||||
color = vec4(clamp(0.5 + sharpness * sin(2.0 * 3.1428 * reflexionVector.x*ScaleFactor), 0.0, 1.0));
|
||||
color.a = 1.0;
|
||||
gl_FragColor = min(color, vec4(1.0,1.0,1.0,1.0));
|
||||
gl_FragColor = vec4(vec3(sharpness), 1.0);
|
||||
gl_FragColor = clamp(dot(gl_LightSource[0].position.xyz, n)*Shading + (1.0-Shading), 0.0, 1.0) * min(color, vec4(1.0,1.0,1.0,1.0));
|
||||
}
|
||||
|
||||
@ -42,13 +42,17 @@
|
||||
</FPCount>
|
||||
<TexturesPlugins NumberOfPlugins="0" />
|
||||
<TexturedUsed NumberUsedTU="0" />
|
||||
<UniformVariables NumberOfVariables="1">
|
||||
<UniformVariables NumberOfVariables="3">
|
||||
<Uniform0 Type="5" Name="ScaleFactor" ArraySize="1" Widget="2" Min="0" Max="100" Step="1">
|
||||
<Values Value0="5" />
|
||||
<Values Value0="25" />
|
||||
</Uniform0>
|
||||
|
||||
<Uniform0 Type="5" Name="Smoothing" ArraySize="1" Widget="2" Min="0.5" Max="10" Step="1">
|
||||
<Values Value0="1" />
|
||||
<Values Value0="3" />
|
||||
</Uniform0>
|
||||
|
||||
<Uniform0 Type="5" Name="Shading" ArraySize="1" Widget="2" Min="0.0" Max="1.0" Step="0.05">
|
||||
<Values Value0="0.8" />
|
||||
</Uniform0>
|
||||
|
||||
</UniformVariables>
|
||||
@ -64,4 +68,4 @@
|
||||
<BackMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.2" DifG="0.2" DifB="0.2" DifA="1" SpecR="0.2" SpecG="0.2" SpecB="0.2" SpecA="1" EmiR="0.2" EmiG="0.2" EmiB="0.2" EmiA="1" Shininess="0" />
|
||||
<PointParameters Size="1" MinSize="0" MaxSize="1" Threshold="1" ConstantAttenuation="1" LinearAttenuation="0" QuadraticAttenuation="0" />
|
||||
</BuiltInStates>
|
||||
</GLSLang>
|
||||
</GLSLang>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user