Commit dfe007a4 authored by Dirk Albrecht's avatar Dirk Albrecht
Browse files

[CHANGE]Depthcueing factor is now clamped to avoid very dark oder bright...

[CHANGE]Depthcueing factor is now clamped to avoid very dark oder bright areas. Using QuadStrips to render the tubes.
parent fbd492a1
......@@ -509,7 +509,7 @@ void WTubeDrawable::drawTubes( osg::RenderInfo& renderInfo ) const
{
if ( (*active)[i] )
{
state.glDrawArraysInstanced( GL_TRIANGLE_STRIP, m_tubeStartIndexes->at(i), 2 * (*pointsPerLine)[i], 1);
state.glDrawArraysInstanced( GL_QUAD_STRIP, m_tubeStartIndexes->at(i), 2 * (*pointsPerLine)[i], 1);
}
}
}
......
......@@ -45,6 +45,7 @@ void main()
newTexCoords.y = (imageTangentNorm.y * (gl_PointCoord.x - 0.5) - imageTangentNorm.x * (gl_PointCoord.y - 0.5)) + 0.5;
color = texture2D(texturePS, newTexCoords.xy);
//color = texture2D(texturePS, gl_PointCoord.xy);
if(endPoint == 0.0)
{
......@@ -66,4 +67,3 @@ void main()
float depthCueingFactor = (1 - (z+zNear)/(zNear+zFar));
gl_FragColor.rgb = tubeColor.rgb * ((color.x) + specular) * depthCueingFactor * depthCueingFactor;
}
......@@ -78,13 +78,13 @@ thickness *= length(referencePosition);
if(tmp > 0.93 || gl_MultiTexCoord0.t == 0.0)
{
vec4 pos1 = gl_Vertex;
vec4 pos2 = gl_Vertex + vec4(gl_Normal,0);
vec4 pos2 = gl_Vertex + vec4(gl_Normal,1);
vec4 pos1p = gl_ModelViewProjectionMatrix * pos1.xyzw;
vec4 pos2p = gl_ModelViewProjectionMatrix * pos2.xyzw;
imageTangent.xy = (pos2p.x/pos2p.w - pos1p.x/pos1p.w, pos1p.y/pos1p.w - pos2p.y/pos2p.w);
imageTangent = normalize(imageTangent);
// compute size with u_viewportWidth and u_viewportHeight;
gl_PointSize = length(vec2(offset.x, offset.y));
//gl_PointSize = 20;
......
......@@ -52,7 +52,6 @@ void main()
specular = pow(NdotHV,16) * color.y;
}
float depthCueingFactor = (1 - (z+zNear)/(zNear+zFar));
float depthCueingFactor = clamp((1 - (z+zNear)/(zNear+zFar)),0.5,0.95);
gl_FragColor.rgb = tubeColor.rgb * ((color.x) + specular) * depthCueingFactor * depthCueingFactor;
}
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