[OpenWalnut-Dev] [OW-Modules] r285: [FIX] fiber stipples now actually render stipples again; there is still a problem with stipple directions
Andre Reichenbach
reichenbach at informatik.uni-leipzig.de
Sat Mar 28 12:24:20 CET 2015
I fixed the interpolation recently and also checked the directions via
vector plot. I also checked that the interpolation function in the
dataset works correctly (vector plot only shows directions at grid points).
I think the problem is somehow related to the fragment shader; will try
to fix it on Monday. I also still need to fix the eigenvector
interpolation in the shader. Do you know where the "u_vectorsMin" and
"u_vectorsScale"
uniforms come from? Were they automatically provided to the shader by
WGETexture at some time?
On 03/28/2015 10:21 AM, Mathias Goldau wrote:
> I remember that the stipple directions were influenced with the vector interpolation (recently fixed for rotated grids).
>
>
>> Am 27.03.2015 um 17:18 schrieb reichenbach at informatik.uni-leipzig.de:
>>
>> *Branch default*
>> [FIX] fiber stipples now actually render stipples again; there is still a problem with stipple directions
>>
>> changeset 285:17ea4ffe7fc1 in /srv/hg/ow-modules (Fri Mar 27 17:18:20 2015 +0100):
>>
>> diffstat:
>>
>> FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-fragment.glsl | 532 +++------
>> FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-uniforms.glsl | 2 +-
>> FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-varyings.glsl | 5 +-
>> FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-vertex.glsl | 18 +-
>> 4 files changed, 186 insertions(+), 371 deletions(-)
>>
>> diffs (637 lines):
>>
>> diff -r 049641c7f75d -r 17ea4ffe7fc1 FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-fragment.glsl
>> --- a/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-fragment.glsl Thu Mar 26 16:13:52 2015 +0100
>> +++ b/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-fragment.glsl Fri Mar 27 17:18:20 2015 +0100
>> @@ -36,122 +36,123 @@
>> return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
>> }
>>
>> -/**
>> - * Converts HSL colors to RGB colors. This is used in this shader later to draw from a single random, a whole color (hue).
>> - */
>> -vec4 hsv_to_rgb(float h, float s, float v, float a)
>> -{
>> - float c = v * s;
>> - h = mod((h * 6.0), 6.0);
>> - float x = c * (1.0 - abs(mod(h, 2.0) - 1.0));
>> - vec4 color;
>> -
>> - if (0.0 <= h && h < 1.0) {
>> - color = vec4(c, x, 0.0, a);
>> - } else if (1.0 <= h && h < 2.0) {
>> - color = vec4(x, c, 0.0, a);
>> - } else if (2.0 <= h && h < 3.0) {
>> - color = vec4(0.0, c, x, a);
>> - } else if (3.0 <= h && h < 4.0) {
>> - color = vec4(0.0, x, c, a);
>> - } else if (4.0 <= h && h < 5.0) {
>> - color = vec4(x, 0.0, c, a);
>> - } else if (5.0 <= h && h < 6.0) {
>> - color = vec4(c, 0.0, x, a);
>> - } else {
>> - color = vec4(0.0, 0.0, 0.0, a);
>> - }
>> -
>> - color.rgb += v - c;
>> -
>> - return color;
>> -}
>> -
>> -vec4 hotIron( in float value )
>> -{
>> - // // BLUE <-> RED
>> - // vec4 color8 = vec4( 255.0 / 255.0, 255.0 / 255.0, 204.0 / 255.0, 1.0 );
>> - // vec4 color7 = vec4( 255.0 / 255.0, 237.0 / 255.0, 160.0 / 255.0, 1.0 );
>> - // vec4 color6 = vec4( 254.0 / 255.0, 217.0 / 255.0, 118.0 / 255.0, 1.0 );
>> - // vec4 color5 = vec4( 254.0 / 255.0, 178.0 / 255.0, 76.0 / 255.0, 1.0 );
>> - // vec4 color4 = vec4( 253.0 / 255.0, 141.0 / 255.0, 60.0 / 255.0, 1.0 );
>> - // vec4 color3 = vec4( 252.0 / 255.0, 78.0 / 255.0, 42.0 / 255.0, 1.0 );
>> - // vec4 color2 = vec4( 205.0 / 255.0, 000.0 / 255.0, 000.0 / 255.0, 1.0 );
>> - // vec4 color1 = vec4( 180.0 / 255.0, 85.0 / 255.0, 255.0 / 255.0, 1.0 );
>> - // vec4 color0 = vec4( 000.0 / 255.0, 150.0 / 255.0, 255.0 / 255.0, 1.0 );
>> -
>> - // HOT IRON
>> - vec4 color8 = vec4( 255.0 / 255.0, 255.0 / 255.0, 204.0 / 255.0, 1.0 );
>> - vec4 color7 = vec4( 255.0 / 255.0, 237.0 / 255.0, 160.0 / 255.0, 1.0 );
>> - vec4 color6 = vec4( 254.0 / 255.0, 217.0 / 255.0, 118.0 / 255.0, 1.0 );
>> - vec4 color5 = vec4( 254.0 / 255.0, 178.0 / 255.0, 76.0 / 255.0, 1.0 );
>> - vec4 color4 = vec4( 253.0 / 255.0, 141.0 / 255.0, 60.0 / 255.0, 1.0 );
>> - vec4 color3 = vec4( 252.0 / 255.0, 78.0 / 255.0, 42.0 / 255.0, 1.0 );
>> - vec4 color2 = vec4( 227.0 / 255.0, 26.0 / 255.0, 28.0 / 255.0, 1.0 );
>> - vec4 color1 = vec4( 189.0 / 255.0, 0.0 / 255.0, 38.0 / 255.0, 1.0 );
>> - vec4 color0 = vec4( 128.0 / 255.0, 0.0 / 255.0, 38.0 / 255.0, 1.0 );
>> -
>> - // In order to use a different color map use the colors in the BLUE <-> RED section above from color0 to colorN.
>> - // Depending on how much colors you need, set then the colorNum to e.g. 2 when using only two colors.
>> - //
>> - // // HOT IRON
>> - int colorNum = 8;
>> - // // BLUE <-> RED
>> - // int colorNum = 3;
>> -
>> - float colorValue = value * float( colorNum );
>> - int sel = int( floor( colorValue ) );
>> -
>> - if( sel >= colorNum )
>> - {
>> - return color0;
>> - }
>> - else if( sel < 0 )
>> - {
>> - return color0;
>> - }
>> - else
>> - {
>> - colorValue -= float( sel );
>> -
>> - if( sel < 1 )
>> - {
>> - return ( color1 * colorValue + color0 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 2 )
>> - {
>> - return ( color2 * colorValue + color1 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 3 )
>> - {
>> - return ( color3 * colorValue + color2 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 4 )
>> - {
>> - return ( color4 * colorValue + color3 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 5 )
>> - {
>> - return ( color5 * colorValue + color4 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 6 )
>> - {
>> - return ( color6 * colorValue + color5 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 7 )
>> - {
>> - return ( color7 * colorValue + color6 * ( 1.0 - colorValue ) );
>> - }
>> - else if( sel < 8 )
>> - {
>> - return ( color8 * colorValue + color7 * ( 1.0 - colorValue ) );
>> - }
>> - else
>> - {
>> - return color0;
>> - }
>> - }
>> -}
>> +// /**
>> +// * Converts HSL colors to RGB colors. This is used in this shader later to draw from a single random, a whole color (hue).
>> +// */
>> +// vec4 hsv_to_rgb(float h, float s, float v, float a)
>> +// {
>> +// float c = v * s;
>> +// h = mod((h * 6.0), 6.0);
>> +// float x = c * (1.0 - abs(mod(h, 2.0) - 1.0));
>> +// vec4 color;
>> +//
>> +// if (0.0 <= h && h < 1.0) {
>> +// color = vec4(c, x, 0.0, a);
>> +// } else if (1.0 <= h && h < 2.0) {
>> +// color = vec4(x, c, 0.0, a);
>> +// } else if (2.0 <= h && h < 3.0) {
>> +// color = vec4(0.0, c, x, a);
>> +// } else if (3.0 <= h && h < 4.0) {
>> +// color = vec4(0.0, x, c, a);
>> +// } else if (4.0 <= h && h < 5.0) {
>> +// color = vec4(x, 0.0, c, a);
>> +// } else if (5.0 <= h && h < 6.0) {
>> +// color = vec4(c, 0.0, x, a);
>> +// } else {
>> +// color = vec4(0.0, 0.0, 0.0, a);
>> +// }
>> +//
>> +// color.rgb += v - c;
>> +//
>> +// return color;
>> +// }
>> +//
>> +// vec4 hotIron( in float value )
>> +// {
>> +// // // BLUE <-> RED
>> +// // vec4 color8 = vec4( 255.0 / 255.0, 255.0 / 255.0, 204.0 / 255.0, 1.0 );
>> +// // vec4 color7 = vec4( 255.0 / 255.0, 237.0 / 255.0, 160.0 / 255.0, 1.0 );
>> +// // vec4 color6 = vec4( 254.0 / 255.0, 217.0 / 255.0, 118.0 / 255.0, 1.0 );
>> +// // vec4 color5 = vec4( 254.0 / 255.0, 178.0 / 255.0, 76.0 / 255.0, 1.0 );
>> +// // vec4 color4 = vec4( 253.0 / 255.0, 141.0 / 255.0, 60.0 / 255.0, 1.0 );
>> +// // vec4 color3 = vec4( 252.0 / 255.0, 78.0 / 255.0, 42.0 / 255.0, 1.0 );
>> +// // vec4 color2 = vec4( 205.0 / 255.0, 000.0 / 255.0, 000.0 / 255.0, 1.0 );
>> +// // vec4 color1 = vec4( 180.0 / 255.0, 85.0 / 255.0, 255.0 / 255.0, 1.0 );
>> +// // vec4 color0 = vec4( 000.0 / 255.0, 150.0 / 255.0, 255.0 / 255.0, 1.0 );
>> +//
>> +// // HOT IRON
>> +// vec4 color8 = vec4( 255.0 / 255.0, 255.0 / 255.0, 204.0 / 255.0, 1.0 );
>> +// vec4 color7 = vec4( 255.0 / 255.0, 237.0 / 255.0, 160.0 / 255.0, 1.0 );
>> +// vec4 color6 = vec4( 254.0 / 255.0, 217.0 / 255.0, 118.0 / 255.0, 1.0 );
>> +// vec4 color5 = vec4( 254.0 / 255.0, 178.0 / 255.0, 76.0 / 255.0, 1.0 );
>> +// vec4 color4 = vec4( 253.0 / 255.0, 141.0 / 255.0, 60.0 / 255.0, 1.0 );
>> +// vec4 color3 = vec4( 252.0 / 255.0, 78.0 / 255.0, 42.0 / 255.0, 1.0 );
>> +// vec4 color2 = vec4( 227.0 / 255.0, 26.0 / 255.0, 28.0 / 255.0, 1.0 );
>> +// vec4 color1 = vec4( 189.0 / 255.0, 0.0 / 255.0, 38.0 / 255.0, 1.0 );
>> +// vec4 color0 = vec4( 128.0 / 255.0, 0.0 / 255.0, 38.0 / 255.0, 1.0 );
>> +//
>> +// // In order to use a different color map use the colors in the BLUE <-> RED section above from color0 to colorN.
>> +// // Depending on how much colors you need, set then the colorNum to e.g. 2 when using only two colors.
>> +// //
>> +// // // HOT IRON
>> +// int colorNum = 8;
>> +// // // BLUE <-> RED
>> +// // int colorNum = 3;
>> +//
>> +// float colorValue = value * float( colorNum );
>> +// int sel = int( floor( colorValue ) );
>> +//
>> +// if( sel >= colorNum )
>> +// {
>> +// return color0;
>> +// }
>> +// else if( sel < 0 )
>> +// {
>> +// return color0;
>> +// }
>> +// else
>> +// {
>> +// colorValue -= float( sel );
>> +//
>> +// if( sel < 1 )
>> +// {
>> +// return ( color1 * colorValue + color0 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 2 )
>> +// {
>> +// return ( color2 * colorValue + color1 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 3 )
>> +// {
>> +// return ( color3 * colorValue + color2 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 4 )
>> +// {
>> +// return ( color4 * colorValue + color3 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 5 )
>> +// {
>> +// return ( color5 * colorValue + color4 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 6 )
>> +// {
>> +// return ( color6 * colorValue + color5 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 7 )
>> +// {
>> +// return ( color7 * colorValue + color6 * ( 1.0 - colorValue ) );
>> +// }
>> +// else if( sel < 8 )
>> +// {
>> +// return ( color8 * colorValue + color7 * ( 1.0 - colorValue ) );
>> +// }
>> +// else
>> +// {
>> +// return color0;
>> +// }
>> +// }
>> +// }
>> +//
>>
>> /**
>> * Computes voxel corner positions in pos[8] and retrieve vectors from u_vectorsSampler. This way we access all 8 surrunding vectors and may perform
>> @@ -167,68 +168,67 @@
>> *
>> * @return interpolated vector at position textPos
>> */
>> -vec3 customInterpolate( vec3 textPos, out vec3 interpolDiff )
>> -{
>> - vec3 pos[8];
>> - pos[0] = vec3( floor( textPos.x ), floor( textPos.y ), floor( textPos.z ) );
>> - pos[1] = vec3( ceil( textPos.x ), floor( textPos.y ), floor( textPos.z ) );
>> - pos[2] = vec3( floor( textPos.x ), ceil( textPos.y ), floor( textPos.z ) );
>> - pos[3] = vec3( ceil( textPos.x ), ceil( textPos.y ), floor( textPos.z ) );
>> - pos[4] = vec3( floor( textPos.x ), floor( textPos.y ), ceil( textPos.z ) );
>> - pos[5] = vec3( ceil( textPos.x ), floor( textPos.y ), ceil( textPos.z ) );
>> - pos[6] = vec3( floor( textPos.x ), ceil( textPos.y ), ceil( textPos.z ) );
>> - pos[7] = vec3( ceil( textPos.x ), ceil( textPos.y ), ceil( textPos.z ) );
>> -
>> - vec3 localPos = textPos - pos[0];
>> - float lambdaX = localPos.x * u_pixelSizeX;
>> - float lambdaY = localPos.y * u_pixelSizeY;
>> - float lambdaZ = localPos.z * u_pixelSizeZ;
>> -
>> - float h[8];
>> - h[0] = ( 1 - lambdaX ) * ( 1 - lambdaY ) * ( 1 - lambdaZ );
>> - h[1] = ( lambdaX ) * ( 1 - lambdaY ) * ( 1 - lambdaZ );
>> - h[2] = ( 1 - lambdaX ) * ( lambdaY ) * ( 1 - lambdaZ );
>> - h[3] = ( lambdaX ) * ( lambdaY ) * ( 1 - lambdaZ );
>> - h[4] = ( 1 - lambdaX ) * ( 1 - lambdaY ) * ( lambdaZ );
>> - h[5] = ( lambdaX ) * ( 1 - lambdaY ) * ( lambdaZ );
>> - h[6] = ( 1 - lambdaX ) * ( lambdaY ) * ( lambdaZ );
>> - h[7] = ( lambdaX ) * ( lambdaY ) * ( lambdaZ );
>> -
>> - vec3 result = vec3( 0, 0, 0 );
>> - vec3 v[8];
>> - float dist = 9999999;
>> - int nearest = 9999999;
>> - for( int i = 0; i < 8; ++i )
>> - {
>> - if( length( pos[i] - textPos ) < dist )
>> - {
>> - dist = length( pos[i] - textPos );
>> - nearest = i;
>> - }
>> - pos[i].x /= u_pixelSizeX * ( u_probTractSizeX -1 );
>> - pos[i].y /= u_pixelSizeY * ( u_probTractSizeY -1 );
>> - pos[i].z /= u_pixelSizeZ * ( u_probTractSizeZ -1 );
>> - v[i] = texture3DUnscaled( u_vectorsSampler, pos[i], u_vectorsMin, u_vectorsScale ).xyz;
>> - // for orientation swaps use the step function below instead of 1.0
>> - float sgn = 1.0; // step( 0, dot( v[0], v[i] ) )*2 - 1;
>> - result += h[i] * sgn * v[i];
>> - }
>> -
>> - result = v[nearest];
>> - textPos.x /= u_pixelSizeX * ( u_probTractSizeX);
>> - textPos.y /= u_pixelSizeY * ( u_probTractSizeY);
>> - textPos.z /= u_pixelSizeZ * ( u_probTractSizeZ);
>> -
>> - interpolDiff = vec3( 1, 1, 1 ) - abs( result - texture3DUnscaled( u_vectorsSampler, textPos, u_vectorsMin, u_vectorsScale ).xyz );
>> -
>> - return normalize( result );
>> -}
>> +// vec3 customInterpolate( vec3 textPos, out vec3 interpolDiff )
>> +// {
>> +// vec3 pos[8];
>> +// pos[0] = vec3( floor( textPos.x ), floor( textPos.y ), floor( textPos.z ) );
>> +// pos[1] = vec3( ceil( textPos.x ), floor( textPos.y ), floor( textPos.z ) );
>> +// pos[2] = vec3( floor( textPos.x ), ceil( textPos.y ), floor( textPos.z ) );
>> +// pos[3] = vec3( ceil( textPos.x ), ceil( textPos.y ), floor( textPos.z ) );
>> +// pos[4] = vec3( floor( textPos.x ), floor( textPos.y ), ceil( textPos.z ) );
>> +// pos[5] = vec3( ceil( textPos.x ), floor( textPos.y ), ceil( textPos.z ) );
>> +// pos[6] = vec3( floor( textPos.x ), ceil( textPos.y ), ceil( textPos.z ) );
>> +// pos[7] = vec3( ceil( textPos.x ), ceil( textPos.y ), ceil( textPos.z ) );
>> +//
>> +// vec3 localPos = textPos - pos[0];
>> +// float lambdaX = localPos.x * u_pixelSizeX;
>> +// float lambdaY = localPos.y * u_pixelSizeY;
>> +// float lambdaZ = localPos.z * u_pixelSizeZ;
>> +//
>> +// float h[8];
>> +// h[0] = ( 1 - lambdaX ) * ( 1 - lambdaY ) * ( 1 - lambdaZ );
>> +// h[1] = ( lambdaX ) * ( 1 - lambdaY ) * ( 1 - lambdaZ );
>> +// h[2] = ( 1 - lambdaX ) * ( lambdaY ) * ( 1 - lambdaZ );
>> +// h[3] = ( lambdaX ) * ( lambdaY ) * ( 1 - lambdaZ );
>> +// h[4] = ( 1 - lambdaX ) * ( 1 - lambdaY ) * ( lambdaZ );
>> +// h[5] = ( lambdaX ) * ( 1 - lambdaY ) * ( lambdaZ );
>> +// h[6] = ( 1 - lambdaX ) * ( lambdaY ) * ( lambdaZ );
>> +// h[7] = ( lambdaX ) * ( lambdaY ) * ( lambdaZ );
>> +//
>> +// vec3 result = vec3( 0, 0, 0 );
>> +// vec3 v[8];
>> +// float dist = 9999999;
>> +// int nearest = 9999999;
>> +// for( int i = 0; i < 8; ++i )
>> +// {
>> +// if( length( pos[i] - textPos ) < dist )
>> +// {
>> +// dist = length( pos[i] - textPos );
>> +// nearest = i;
>> +// }
>> +// pos[i].x /= u_pixelSizeX * ( u_probTractSizeX -1 );
>> +// pos[i].y /= u_pixelSizeY * ( u_probTractSizeY -1 );
>> +// pos[i].z /= u_pixelSizeZ * ( u_probTractSizeZ -1 );
>> +// v[i] = texture3DUnscaled( u_vectorsSampler, pos[i], u_vectorsMin, u_vectorsScale ).xyz;
>> +// // for orientation swaps use the step function below instead of 1.0
>> +// float sgn = 1.0; // step( 0, dot( v[0], v[i] ) )*2 - 1;
>> +// result += h[i] * sgn * v[i];
>> +// }
>> +//
>> +// result = v[nearest];
>> +// textPos.x /= u_pixelSizeX * ( u_probTractSizeX);
>> +// textPos.y /= u_pixelSizeY * ( u_probTractSizeY);
>> +// textPos.z /= u_pixelSizeZ * ( u_probTractSizeZ);
>> +//
>> +// interpolDiff = vec3( 1, 1, 1 ) - abs( result - texture3DUnscaled( u_vectorsSampler, textPos, u_vectorsMin, u_vectorsScale ).xyz );
>> +//
>> +// return normalize( result );
>> +// }
>>
>> void main()
>> {
>> - // get principal diffusion direction
>> - vec3 interpolDiff;
>> - vec3 diffusionDirection = customInterpolate( v_textPos, interpolDiff );
>> + // vec3 diffusionDirection = customInterpolate( v_textPos, interpolDiff );
>> + vec3 diffusionDirection = texture3D( u_vectorsSampler, v_vecTexturePos ).xyz;
>>
>> // project into plane (given by two vectors aVec and bVec)
>> vec3 aVecNorm = normalize( u_aVec );
>> @@ -243,15 +243,8 @@
>>
>> vec3 scaledFocalPoint1 = middlePoint_tex + u_scale * projectedDirectionTextCoords;
>> vec3 scaledFocalPoint2 = middlePoint_tex - u_scale * projectedDirectionTextCoords;
>> - vec3 focalPoint1 = middlePoint_tex + projectedDirectionTextCoords;
>> - vec3 focalPoint2 = middlePoint_tex - projectedDirectionTextCoords;
>>
>> - vec3 texturePosition = v_textPos;
>> - texturePosition.x /= u_pixelSizeX * u_probTractSizeX;
>> - texturePosition.y /= u_pixelSizeY * u_probTractSizeY;
>> - texturePosition.z /= u_pixelSizeZ * u_probTractSizeZ;
>> -
>> - float col = texture3D( u_colSampler, texturePosition ).r;
>> + float col = texture3D( u_colSampler, v_colorTexturePos ).r;
>>
>> // generally the area of a line stipple is a circle with radius R (each half for the endings of the line stipple) plus
>> // a quad with height 2R and width length of the focalPoints v and w. hence we have this equation in R to solve:
>> @@ -268,49 +261,10 @@
>> float r2 = p2 - sqrt( p2 * p2 + q );
>> float radius = max( r1, r2 );// - 0.05;
>>
>> - // // Debug: for fixed radius
>> - // radius = 0.01* u_glyphThickness;
>> -
>> - // // debug positions: This will draw only a circle if you want to see the positions. You need to disable all other stuff
>> - // vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
>> - // //if( gl_TexCoord[2].x == 0 )
>> - // //{
>> - // // color = vec4( 107.0 / 255.0, 138.0 / 255.0, 67.0 / 255.0, 1.0 );
>> - // //}
>> - // //else if( gl_TexCoord[2].x == 1 )
>> - // //{
>> - // // color = vec4( 28.0 / 255.0, 74.0 / 255.0, 147.0 / 255.0, 1.0 );
>> - // //}
>> - // //else if( gl_TexCoord[2].x == 2 )
>> - // //{
>> - // // color = vec4( 226.0 / 255.0, 180.0 / 255.0, 55.0 / 255.0, 1.0 );
>> - // //}
>> - // //else if( gl_TexCoord[2].x == 3 )
>> - // //{
>> - // // color = vec4( 173.0 / 255.0, 72.0 / 255.0, 34.0 / 255.0, 1.0 );
>> - // //}
>> - // // else {
>> - // // discard;
>> - // // }
>> - // float lp = distance( gl_TexCoord[1].xyz, middlePoint_tex );
>> - // if( lp < 0.5 )
>> - // {
>> - // gl_FragColor = color;
>> - // }
>> -
>> vec4 white = vec4( 1, 1, 1, 1 );
>> vec4 black = vec4( 0, 0, 0, 1 );
>>
>> vec4 color = u_color;
>> - // Enable this for textured stipples
>> - // ///////////// if( u_color.r == 1.0 ) { // this if, realises one FS to be colored with texture while the other set is colored with fixed color
>> - // ///////////// if( col < 0.5 ) {
>> - // ///////////// discard;
>> - // ///////////// }
>> - // ///////////// else {
>> - // color = hotIron( ( col - 0.5 ) * 2 );
>> - // ///////////// }
>> - // /////////////}
>>
>> // opacity filtered color (default)
>> vec4 c = color * pow( v_probability, 1.0 / (10.0 * u_colorThreshold) );
>> @@ -319,32 +273,6 @@
>> c = color;
>> }
>>
>> - // mod: dark stipples in bright regions, bright stipples in dark regions
>> - // c.r = c.r - 0.2 + 0.2 * ( 1 - 2.0 * col );
>> -
>> - // // Debug: hotIron colormapping of the probability.
>> - // vec4 c = hotIron( 1.0 - v_probability );
>> -
>> - // Feature: enable this if you want fiber stipples color from separate texture (where 'col' variable is refferring to).
>> - // vec4 c = hotIron( col );
>> - // // with opacity or with out
>> - // c.a = probability;
>> -
>> - // // if you want thresholding
>> - // if( col < 0.51 )
>> - // c = vec4(0,0,0.8, 1 );
>> - // else
>> - // c = hotIron( col * 2 - 1.0 );
>> - // c.a = 0.2 + probability;
>> -
>> - // vec4 c = white;
>> -
>> - // vec4 c = black;
>> -
>> - // // Debug: random color
>> - // float r = rand( vec2( scaledFocalPoint1.xy ) );
>> - // vec4 c = hsv_to_rgb( r, 1, 1, 1 );
>> -
>> float dist = distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 );
>>
>> if( u_outlineInOut ) {
>> @@ -423,111 +351,5 @@
>> discard;
>> }
>> }
>> -// else
>> -// {
>> -// if( u_outline > 0.0 )
>> -// {
>> -// // Debug: Enable fade to black
>> -// float gray = 1.0;
>> -// float alpha = v_probability + 0.5;
>> -// float u_outlineWidth = 0.019;
>> -// if( dist < ( radius + 0.0 + 8.0 * u_outlineWidth ) ) { float gg = gray - 0.9; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.7 ); }
>> -// if( dist < ( radius + 0.0 + 7.0 * u_outlineWidth ) ) { float gg = gray - 0.7; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.6 ); }
>> -// if( dist < ( radius + 0.0 + 6.0 * u_outlineWidth ) ) { float gg = gray - 0.5; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.5 ); }
>> -// if( dist < ( radius + 0.0 + 5.0 * u_outlineWidth ) ) { float gg = gray - 0.4; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.4 ); }
>> -// if( dist < ( radius + 0.0 + 4.0 * u_outlineWidth ) ) { float gg = gray - 0.3; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.3 ); }
>> -// if( dist < ( radius + 0.0 + 3.0 * u_outlineWidth ) ) { float gg = gray - 0.2; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.2 ); }
>> -// if( dist < ( radius + 0.0 + 2.0 * u_outlineWidth ) ) { float gg = gray - 0.1; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.1 ); }
>> -// if( dist < ( radius + 0.0 + 1.0 * u_outlineWidth ) ) { float gg = gray - 0.0; gl_FragColor = vec4( c * gg ) + vec4( 0,0,0, 0.0 ); }
>> -//
>> -// // // Debug: colored outline only
>> -// // c.a=1.0;
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 1.0 * u_outlineWidth ) ) { float gg = gray - 0.0; gl_FragColor = vec4( c ) + vec4( 0,0,0, 0.0 ); }
>> -//
>> -// // // Debug: Enable fade to black
>> -// // float gray = 1.0;
>> -// // float alpha = v_probability + 0.5;
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.040 ) ) { float gg = gray - 0.0; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.7 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.035 ) ) { float gg = gray - 0.1; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.6 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.030 ) ) { float gg = gray - 0.2; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.5 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.025 ) ) { float gg = gray - 0.3; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.4 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.020 ) ) { float gg = gray - 0.4; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.3 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.015 ) ) { float gg = gray - 0.5; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.2 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.010 ) ) { float gg = gray - 0.7; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.1 ); }
>> -// // if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.005 ) ) { float gg = gray - 0.9; gl_FragColor = vec4( white * gg ) + vec4( 0,0,0, 0.0 ); }
>> -//
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) > ( radius + 8 * u_outlineWidth ) ) {
>> -// discard;
>> -// }
>> -// }
>> -// else {
>> -// // Debug: Enable fade to black
>> -// float gray = 1.0;
>> -// float alpha = v_probability + 0.5;
>> -// float u_outlineWidth = 0.009;
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 8.0 * u_outlineWidth ) ) { float gg = gray - 0.9; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 7.0 * u_outlineWidth ) ) { float gg = gray - 0.7; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 6.0 * u_outlineWidth ) ) { float gg = gray - 0.5; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 5.0 * u_outlineWidth ) ) { float gg = gray - 0.4; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 4.0 * u_outlineWidth ) ) { float gg = gray - 0.3; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 3.0 * u_outlineWidth ) ) { float gg = gray - 0.2; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 2.0 * u_outlineWidth ) ) { float gg = gray - 0.1; gl_FragColor = vec4( c );}
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) < ( radius + 0.0 + 1.0 * u_outlineWidth ) ) { float gg = gray - 0.0; gl_FragColor = vec4( c );}
>> -//
>> -// if( distancePointLineSegment( gl_TexCoord[1].xyz, scaledFocalPoint1, scaledFocalPoint2 ) > ( radius + 8 * u_outlineWidth ) ) {
>> -// discard;
>> -// }
>> -// }
>> -//
>> -// // // Draw quad and inner cricle
>> -// // gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 );
>> -// // float lp = distance( gl_TexCoord[1].xyz, middlePoint_tex );
>> -// // if( lp < 0.5 )
>> -// // {
>> -// // gl_FragColor = vec4( 0.7, 0.7, 1.0, 1.0 ); // discard;
>> -// // }
>> -// }
>> +}
>>
>> - // // Draw Line and focal points
>> - // if( distancePointLineSegment( gl_TexCoord[1].xyz, focalPoint1, focalPoint2 ) < 0.01 )
>> - // {
>> - // if( l <= 1.1 )
>> - // {
>> - // gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
>> - // }
>> - // else if( l < 1.225 )
>> - // {
>> - // gl_FragColor = vec4( 0.0, 1.0, 0.0, 1.0 );
>> - // }
>> - // else
>> - // {
>> - // gl_FragColor = vec4( 0.0, 0.0, 1.0, 1.0 );
>> - // }
>> - // }
>> - // // display middle point
>> - // if( distance( gl_TexCoord[1].xyz, middlePoint_tex ) <= 0.02 )
>> - // {
>> - // gl_FragColor = vec4( 0.0, 1.0, 0.0, 1.0 ); // green
>> - // }
>> -
>> - // // display new focal points
>> - // if( ( distance( gl_TexCoord[1].xyz, scaledFocalPoint1 ) < 0.01 ) )
>> - // {
>> - // gl_FragColor = vec4( 0.0, 1.0, 1.0, 1.0 ); // cyan
>> - // }
>> - // if( ( distance( gl_TexCoord[1].xyz, scaledFocalPoint2 ) < 0.01 ) )
>> - // {
>> - // gl_FragColor = vec4( 0.0, 0.0, 1.0, 1.0 ); // blue
>> - // }
>> -
>> - // // display evec end points
>> - // if( ( distance( gl_TexCoord[1].xyz, focalPoint1 ) < 0.01 ) )
>> - // {
>> - // gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); // red
>> - // }
>> -
>> - // if( ( distance( gl_TexCoord[1].xyz, focalPoint2 ) < 0.01 ) )
>> - // {
>> - // gl_FragColor = vec4( 1.0, 1.0, 0.0, 1.0 ); // yellow
>> - // }
>> -}
>> diff -r 049641c7f75d -r 17ea4ffe7fc1 FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-uniforms.glsl
>> --- a/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-uniforms.glsl Thu Mar 26 16:13:52 2015 +0100
>> +++ b/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-uniforms.glsl Fri Mar 27 17:18:20 2015 +0100
>> @@ -108,7 +108,7 @@
>> /**
>> * Scales the quad which is used later for the stipples.
>> */
>> -// uniform float u_glyphSize;
>> +uniform float u_glyphSize;
>>
>> /**
>> * Color of the fiber stipples. This will be further combined with tract probability.
>> diff -r 049641c7f75d -r 17ea4ffe7fc1 FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-varyings.glsl
>> --- a/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-varyings.glsl Thu Mar 26 16:13:52 2015 +0100
>> +++ b/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-varyings.glsl Fri Mar 27 17:18:20 2015 +0100
>> @@ -31,4 +31,7 @@
>>
>> // varying vec3 diff;
>>
>> -varying vec3 v_textPos;
>> +varying vec3 v_probTexturePos;
>> +varying vec3 v_vecTexturePos;
>> +varying vec3 v_colorTexturePos;
>> +
>> diff -r 049641c7f75d -r 17ea4ffe7fc1 FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-vertex.glsl
>> --- a/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-vertex.glsl Thu Mar 26 16:13:52 2015 +0100
>> +++ b/FiberStippleToolbox/src/fiberStipples/shaders/WFiberStipples-vertex.glsl Fri Mar 27 17:18:20 2015 +0100
>> @@ -39,22 +39,12 @@
>> gl_TexCoord[3] = gl_MultiTexCoord3; // for selecting quads within a single hierarchy level
>>
>> // compute texture coordinates from worldspace coordinates for texture access
>> -// mat4 m;
>> -// m[0] = vec4(0.0);
>> -// m[1] = vec4(0.0);
>> -// m[2] = vec4(0.0);
>> -// m[3] = vec4(0.0);
>> -// m[0][0]=m[1][1]=m[2][2]=m[3][3]=1.0;
>> -// m[0][3]=152.315;
>> - vec3 texturePosition = ( u_WorldTransform * gl_Vertex ).xyz;
>> -// vec3 texturePosition = ( m * gl_Vertex ).xyz;
>> - v_textPos = texturePosition;
>> - texturePosition.x /= u_pixelSizeX * u_probTractSizeX;
>> - texturePosition.y /= u_pixelSizeY * u_probTractSizeY;
>> - texturePosition.z /= u_pixelSizeZ * u_probTractSizeZ;
>> + v_probTexturePos = ( gl_TextureMatrix[ 1 ] * u_WorldTransform * gl_Vertex ).xyz;
>> + v_vecTexturePos = ( gl_TextureMatrix[ 0 ] * u_WorldTransform * gl_Vertex ).xyz;
>> + v_colorTexturePos = ( gl_TextureMatrix[ 2 ] * u_WorldTransform * gl_Vertex ).xyz;
>>
>> // get connectivity score from probTract (please not, it is already scaled between 0.0...1.0 from WDataTexture3D::createTexture
>> - v_probability = texture3D( u_probTractSampler, texturePosition ).r;
>> + v_probability = texture3D( u_probTractSampler, v_probTexturePos ).r;
>>
>> // // span quad incase of regions with high probablility
>> if( v_probability > u_threshold && ( u_minRange + v_probability ) * u_maxRange * u_numDensitySlices >= gl_TexCoord[2].x + gl_TexCoord[3].x )
>> _______________________________________________
>> All-openwalnut-commits mailing list
>> All-openwalnut-commits at lists.informatik.uni-leipzig.de
>> http://lists.informatik.uni-leipzig.de/mailman/listinfo/all-openwalnut-commits
>>
> _______________________________________________
> OpenWalnut-Dev mailing list
> OpenWalnut-Dev at lists.informatik.uni-leipzig.de
> http://lists.informatik.uni-leipzig.de/mailman/listinfo/openwalnut-dev
>
> Archive: http://lists.informatik.uni-leipzig.de/pipermail/openwalnut-dev/
More information about the OpenWalnut-Dev
mailing list