[vtkusers] Error in vtkOpenGLGPUVolumeRayCastMapper.cxx, continued

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Apr 27 18:35:25 EDT 2016


Thanks Rick for giving us the case for reproducing the error. I will have
someone look into it.

Thanks,



On Wed, Apr 27, 2016 at 6:28 PM, Richard Frank <rickfrank at me.com> wrote:

> Hi,
>
> I was able to isolate the problem.
>
> We are using vtkLightKit in our application.
>
> Here is a small app that will demonstrate the problem
>
> https://www.dropbox.com/s/crwlm6njmqvdrz4/Source.7z?dl=0
>
>
> But basically all you have to do is:
>
> vtkSmartPointer<vtkLightKit> lightKit =
> vtkSmartPointer<vtkLightKit>::New();
> lightKit->AddLightsToRenderer(ren1);
>
> and render a volume
> and the shader fails to compile.
>
> Can you verify?
>
> Also, while in there the code
>
> this->Impl->ShaderProgram = this->Impl->ShaderCache->ReadyShaderProgram(
> vertexShader.c_str(), fragmentShader.c_str(), "");
> if (!this->Impl->ShaderProgram->GetCompiled())
> {
> vtkErrorMacro("Shader failed to compile");
> }
>
> should be changed to
> if (this->Impl->ShaderProgram == nullptr ||
> !this->Impl->ShaderProgram->GetCompiled())
> {
>
> }
>
> as ReadyShaderProgram returns nullptr at least in this case (which causes
> the crash)
>
> Let me  know if you can repro and, if you fix it I will fetch from git and
> try again.
>
> Thanks!
>
> Rick Frank
>
>
> Begin forwarded message:
> *From: *Richard Frank <rickfrank at me.com>
> *Date: *April 7, 2016 at 11:45:48 AM EDT
> *To: *Aashish Chaudhary <aashish.chaudhary at kitware.com>
> *Cc: *vtkusers at vtk.org
> *Subject: **Re: [vtkusers] Error in vtkOpenGLGPUVolumeRayCastMapper.cxx,
> continued*
>
> Hi,
>
> I pulled from git about 2 or 3 days ago, and got around to testing this AM.
>
> I still crash, albeit slightly different place it seems but the same
> undefined gl_aspect
>
> :
>
> ERROR: In Y:\ThirdParty\vtk700\Rendering\OpenGL2\vtkShaderProgram.cxx,
> line 378
> vtkShaderProgram (00000000362FFA50): 1: #version 150
> 2: #ifdef GL_ES
> 3: #if __VERSION__ == 300
> 4: #define varying in
> 5: #ifdef GL_FRAGMENT_PRECISION_HIGH
> 6: precision highp float;
> 7: precision highp sampler2D;
> 8: precision highp sampler3D;
> 9: #else
> 10: precision mediump float;
> 11: precision mediump sampler2D;
> 12: precision mediump sampler3D;
> 13: #endif
> 14: #define texelFetchBuffer texelFetch
> 15: #define texture1D texture
> 16: #define texture2D texture
> 17: #define texture3D texture
> 18: #endif // 300
> 19: #if __VERSION__ == 100
> 20: #extension GL_OES_standard_derivatives : enable
> 21: #ifdef GL_FRAGMENT_PRECISION_HIGH
> 22: precision highp float;
> 23: #else
> 24: precision mediump float;
> 25: #endif
> 26: #endif // 100
> 27: #else // GL_ES
> 28: #define highp
> 29: #define mediump
> 30: #define lowp
> 31: #if __VERSION__ == 150
> 32: #define varying in
> 33: #define texelFetchBuffer texelFetch
> 34: #define texture1D texture
> 35: #define texture2D texture
> 36: #define texture3D texture
> 37: #endif
> 38: #if __VERSION__ == 120
> 39: #extension GL_EXT_gpu_shader4 : require
> 40: #endif
> 41: #endif // GL_ES
> 42:
> 43:
> 44:
> /*=========================================================================
> 45:
> 46: Program: Visualization Toolkit
> 47: Module: raycasterfs.glsl
> 48:
> 49: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
> 50: All rights reserved.
> 51: See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
> 52:
> 53: This software is distributed WITHOUT ANY WARRANTY; without even
> 54: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> 55: PURPOSE. See the above copyright notice for more information.
> 56:
> 57:
> =========================================================================*/
> 58:
> 59:
> //////////////////////////////////////////////////////////////////////////////
> 60: ///
> 61: /// Inputs
> 62: ///
> 63:
> //////////////////////////////////////////////////////////////////////////////
> 64:
> 65: /// 3D texture coordinates form vertex shader
> 66: varying vec3 ip_textureCoords;
> 67: varying vec3 ip_vertexPos;
> 68:
> 69:
> //////////////////////////////////////////////////////////////////////////////
> 70: ///
> 71: /// Outputs
> 72: ///
> 73:
> //////////////////////////////////////////////////////////////////////////////
> 74:
> 75: vec4 g_fragColor = vec4(0.0);
> 76:
> 77:
> //////////////////////////////////////////////////////////////////////////////
> 78: ///
> 79: /// Uniforms, attributes, and globals
> 80: ///
> 81:
> //////////////////////////////////////////////////////////////////////////////
> 82: vec3 g_dataPos;
> 83: vec3 g_dirStep;
> 84: vec4 g_srcColor;
> 85: vec4 g_eyePosObj;
> 86: bool g_exit;
> 87:
> 88: uniform vec4 in_volume_scale;
> 89: uniform vec4 in_volume_bias;
> 90:
> 91: out vec4 fragOutput0;
> 92:
> 93:
> 94:
> 95: // Volume dataset
> 96: uniform sampler3D in_volume;
> 97: uniform int in_noOfComponents;
> 98: uniform int in_independentComponents;
> 99:
> 100: uniform sampler2D in_noiseSampler;
> 101: #ifndef GL_ES
> 102: uniform sampler2D in_depthSampler;
> 103: #endif
> 104:
> 105: // Camera position
> 106: uniform vec3 in_cameraPos;
> 107:
> 108: // view and model matrices
> 109: uniform mat4 in_volumeMatrix;
> 110: uniform mat4 in_inverseVolumeMatrix;
> 111: uniform mat4 in_projectionMatrix;
> 112: uniform mat4 in_inverseProjectionMatrix;
> 113: uniform mat4 in_modelViewMatrix;
> 114: uniform mat4 in_inverseModelViewMatrix;
> 115: uniform mat4 in_textureDatasetMatrix;
> 116: uniform mat4 in_inverseTextureDatasetMatrix;
> 117: uniform mat4 in_texureToEyeIt;
> 118:
> 119: // Ray step size
> 120: uniform vec3 in_cellStep;
> 121: uniform vec2 in_scalarsRange[4];
> 122: uniform vec3 in_cellSpacing;
> 123:
> 124: // Sample distance
> 125: uniform float in_sampleDistance;
> 126:
> 127: // Scales
> 128: uniform vec3 in_cellScale;
> 129: uniform vec2 in_windowLowerLeftCorner;
> 130: uniform vec2 in_inverseOriginalWindowSize;
> 131: uniform vec2 in_inverseWindowSize;
> 132: uniform vec3 in_textureExtentsMax;
> 133: uniform vec3 in_textureExtentsMin;
> 134:
> 135: // Material and lighting
> 136: uniform vec3 in_diffuse;
> 137: uniform vec3 in_ambient;
> 138: uniform vec3 in_specular;
> 139: uniform float in_shininess;
> 140:
> 141: // Others
> 142: uniform bool in_cellFlag;
> 143: uniform bool in_useJittering;
> 144: vec3 g_xvec;
> 145: vec3 g_yvec;
> 146: vec3 g_zvec;
> 147: uniform bool in_twoSidedLighting;
> 148: vec3 g_cellSpacing;
> 149: float g_avgSpacing;
> 150: vec4 g_fragWorldPos;
> 151: uniform int in_numberOfLights;
> 152: uniform vec3 in_lightAmbientColor[6];
> 153: uniform vec3 in_lightDiffuseColor[6];
> 154: uniform vec3 in_lightSpecularColor[6];
> 155: uniform vec3 in_lightDirection[6];
> 156:
> 157: //VTK::Termination::Dec
> 158:
> 159: //VTK::Cropping::Dec
> 160:
> 161: //VTK::Shading::Dec
> 162:
> 163: //VTK::BinaryMask::Dec
> 164:
> 165: //VTK::CompositeMask::Dec
> 166:
> 167:
> 168: uniform sampler2D in_opacityTransferFunc;
> 169: float computeOpacity(vec4 scalar)
> 170: {
> 171: return texture2D(in_opacityTransferFunc, vec2(scalar.w, 0)).r;
> 172: }
> 173:
> 174:
> 175: uniform sampler2D in_gradientTransferFunc;
> 176: float computeGradientOpacity(vec4 grad)
> 177: {
> 178: return texture2D(in_gradientTransferFunc, vec2(grad.w, 0.0)).r;
> 179: }
> 180: // c is short for component
> 181: vec4 computeGradient(int c)
> 182: {
> 183: vec3 g1;
> 184: vec4 g2;
> 185: g1.x = texture3D(in_volume, vec3(g_dataPos + g_xvec)).x;
> 186: g1.y = texture3D(in_volume, vec3(g_dataPos + g_yvec)).x;
> 187: g1.z = texture3D(in_volume, vec3(g_dataPos + g_zvec)).x;
> 188: g2.x = texture3D(in_volume, vec3(g_dataPos - g_xvec)).x;
> 189: g2.y = texture3D(in_volume, vec3(g_dataPos - g_yvec)).x;
> 190: g2.z = texture3D(in_volume, vec3(g_dataPos - g_zvec)).x;
> 191: g1 = g1 * in_volume_scale.r + in_volume_bias.r;
> 192: g2 = g2 * in_volume_scale.r + in_volume_bias.r;
> 193: g1.x = in_scalarsRange[c][0] + (
> 194: in_scalarsRange[c][1] - in_scalarsRange[c][0]) * g1.x;
> 195: g1.y = in_scalarsRange[c][0] + (
> 196: in_scalarsRange[c][1] - in_scalarsRange[c][0]) * g1.y;
> 197: g1.z = in_scalarsRange[c][0] + (
> 198: in_scalarsRange[c][1] - in_scalarsRange[c][0]) * g1.z;
> 199: g2.x = in_scalarsRange[c][0] + (
> 200: in_scalarsRange[c][1] - in_scalarsRange[c][0]) * g2.x;
> 201: g2.y = in_scalarsRange[c][0] + (
> 202: in_scalarsRange[c][1] - in_scalarsRange[c][0]) * g2.y;
> 203: g2.z = in_scalarsRange[c][0] + (
> 204: in_scalarsRange[c][1] - in_scalarsRange[c][0]) * g2.z;
> 205: g2.xyz = g1 - g2.xyz;
> 206: g2.x /= g_aspect.x;
> 207: g2.y /= g_aspect.y;
> 208: g2.z /= g_aspect.z;
> 209: g2.w = 0.0;
> 210: float grad_mag = length(g2);
> 211: if (grad_mag > 0.0)
> 212: {
> 213: g2.x /= grad_mag;
> 214: g2.y /= grad_mag;
> 215: g2.z /= grad_mag;
> 216: }
> 217: else
> 218: {
> 219: g2.xyz = vec3(0.0, 0.0, 0.0);
> 220: }
> 221: grad_mag = grad_mag * 1.0 / (0.25 * (in_scalarsRange[c][1] -
> 222: (in_scalarsRange[c][0])));
> 223: grad_mag = clamp(grad_mag, 0.0, 1.0);
> 224: g2.w = grad_mag;
> 225: return g2;
> 226: }
> 227:
> 228:
> 229: vec4 computeLighting(vec4 color, int component)
> 230: {
> 231: vec4 finalColor = vec4(0.0);
> 232: // Compute gradient function only once
> 233: vec4 gradient = computeGradient(component);
> 234: g_fragWorldPos = in_modelViewMatrix * in_volumeMatrix *
> 235: in_textureDatasetMatrix * vec4(-g_dataPos, 1.0);
> 236: if (g_fragWorldPos.w != 0.0)
> 237: {
> 238: g_fragWorldPos /= g_fragWorldPos.w;
> 239: }
> 240: vec3 vdir = normalize(g_fragWorldPos.xyz);
> 241: vec3 normal = gradient.xyz;
> 242: vec3 ambient = vec3(0.0);
> 243: vec3 diffuse = vec3(0.0);
> 244: vec3 specular = vec3(0.0);
> 245: float normalLength = length(normal);
> 246: if (normalLength > 0.0)
> 247: {
> 248: normal = normalize((in_texureToEyeIt * vec4(normal, 0.0)).xyz);
> 249: }
> 250: else
> 251: {
> 252: normal = vec3(0.0, 0.0, 0.0);
> 253: }
> 254: for (int lightNum = 0; lightNum < in_numberOfLights; lightNum++)
> 255: {
> 256: vec3 ldir = in_lightDirection[lightNum].xyz;
> 257: vec3 h = normalize(ldir + vdir);
> 258: float nDotH = dot(normal, h);
> 259: if (nDotH < 0.0 && in_twoSidedLighting)
> 260: {
> 261: nDotH = -nDotH;
> 262: }
> 263: float nDotL = dot(normal, ldir);
> 264: if (nDotL < 0.0 && in_twoSidedLighting)
> 265: {
> 266: nDotL = -nDotL;
> 267: }
> 268: if (nDotL > 0.0)
> 269: {
> 270: diffuse += in_lightDiffuseColor[lightNum] * nDotL;
> 271: }
> 272: if (nDotH > 0.0)
> 273: {
> 274: specular = in_lightSpecularColor[lightNum] * pow(nDotH,
> in_shininess);
> 275: }
> 276: ambient += in_lightAmbientColor[lightNum];
> 277: }
> 278: finalColor.xyz = in_ambient * ambient +
> 279: in_diffuse * diffuse * color.rgb +
> 280: in_specular * specular;
> 281: if (gradient.w >= 0.0)
> 282: {
> 283: color.a = color.a *
> 284: computeGradientOpacity(gradient);
> 285: }
> 286: finalColor.a = color.a;
> 287: return finalColor;
> 288: }
> 289:
> 290:
> 291: uniform sampler2D in_colorTransferFunc;
> 292: vec4 computeColor(vec4 scalar, float opacity)
> 293: {
> 294: return computeLighting(vec4(texture2D(in_colorTransferFunc,
> 295: vec2(scalar.w, 0.0)).xyz, opacity), 0);
> 296: }
> 297:
> 298:
> 299: vec3 computeRayDirection()
> 300: {
> 301: return normalize(ip_vertexPos.xyz - g_eyePosObj.xyz);
> 302: }
> 303:
> 304: /// We support only 8 clipping planes for now
> 305: /// The first value is the size of the data array for clipping
> 306: /// planes (origin, normal)
> 307: uniform float in_clippingPlanes[49];
> 308: uniform float in_scale;
> 309: uniform float in_bias;
> 310:
> 311:
> //////////////////////////////////////////////////////////////////////////////
> 312: ///
> 313: /// Main
> 314: ///
> 315:
> //////////////////////////////////////////////////////////////////////////////
> 316: void main()
> 317: {
> 318: /// Initialize g_fragColor (output) to 0
> 319: g_fragColor = vec4(0.0);
> 320: g_dirStep = vec3(0.0);
> 321: g_srcColor = vec4(0.0);
> 322: g_exit = false;
> 323:
> 324:
> 325: bool l_adjustTextureExtents = !in_cellFlag;
> 326: // Get the 3D texture coordinates for lookup into the in_volume
> dataset
> 327: g_dataPos = ip_textureCoords.xyz;
> 328:
> 329: // Eye position in object space
> 330: g_eyePosObj = (in_inverseVolumeMatrix * vec4(in_cameraPos, 1.0));
> 331: if (g_eyePosObj.w != 0.0)
> 332: {
> 333: g_eyePosObj.x /= g_eyePosObj.w;
> 334: g_eyePosObj.y /= g_eyePosObj.w;
> 335: g_eyePosObj.z /= g_eyePosObj.w;
> 336: g_eyePosObj.w = 1.0;
> 337: }
> 338:
> 339: // Getting the ray marching direction (in object space);
> 340: vec3 rayDir = computeRayDirection();
> 341:
> 342: // Multiply the raymarching direction with the step size to get the
> 343: // sub-step size we need to take at each raymarching step
> 344: g_dirStep = (in_inverseTextureDatasetMatrix *
> 345: vec4(rayDir, 0.0)).xyz * in_sampleDistance;
> 346:
> 347: float jitterValue = (texture2D(in_noiseSampler, g_dataPos.xy).x);
> 348: if (in_useJittering)
> 349: {
> 350: g_dataPos += g_dirStep * jitterValue;
> 351: }
> 352: else
> 353: {
> 354: g_dataPos += g_dirStep;
> 355: }
> 356:
> 357: // Flag to deternmine if voxel should be considered for the rendering
> 358: bool l_skip = false;
> 359: g_cellSpacing = vec3(in_cellSpacing[0],
> 360: in_cellSpacing[1],
> 361: in_cellSpacing[2]);
> 362: g_avgSpacing = (g_cellSpacing[0] +
> 363: g_cellSpacing[1] +
> 364: g_cellSpacing[2])/3.0;
> 365: g_xvec = vec3(in_cellStep[0], 0.0, 0.0);
> 366: g_yvec = vec3(0.0, in_cellStep[1], 0.0);
> 367: g_zvec = vec3(0.0, 0.0, in_cellStep[2]);
> 368: // Adjust the aspect
> 369: g_aspect.x = g_cellSpacing[0] * 2.0 / g_avgSpacing;
> 370: g_aspect.y = g_cellSpacing[1] * 2.0 / g_avgSpacing;
> 371: g_aspect.z = g_cellSpacing[2] * 2.0 / g_avgSpacing;
> 372:
> 373:
> 374: // Minimum texture access coordinate
> 375: vec3 l_texMin = vec3(0.0);
> 376: vec3 l_texMax = vec3(1.0);
> 377: if (l_adjustTextureExtents)
> 378: {
> 379: vec3 delta = in_textureExtentsMax - in_textureExtentsMin;
> 380: l_texMin = vec3(0.5) / delta;
> 381: l_texMax = (delta - vec3(0.5)) / delta;
> 382: }
> 383:
> 384: // Flag to indicate if the raymarch loop should terminate
> 385: bool stop = false;
> 386:
> 387: // 2D Texture fragment coordinates [0,1] from fragment coordinates
> 388: // the frame buffer texture has the size of the plain buffer but
> 389: // we use a fraction of it. The texture coordinates is less than 1 if
> 390: // the reduction factor is less than 1.
> 391: // Device coordinates are between -1 and 1. We need texture
> 392: // coordinates between 0 and 1 the in_depthSampler buffer has the
> 393: // original size buffer.
> 394: vec2 fragTexCoord = (gl_FragCoord.xy - in_windowLowerLeftCorner) *
> 395: in_inverseWindowSize;
> 396: float l_terminatePointMax = 0.0;
> 397:
> 398: #ifdef GL_ES
> 399: vec4 l_depthValue = vec4(1.0,1.0,1.0,1.0);
> 400: #else
> 401: vec4 l_depthValue = texture2D(in_depthSampler, fragTexCoord);
> 402: #endif
> 403: // Depth test
> 404: if(gl_FragCoord.z >= l_depthValue.x)
> 405: {
> 406: discard;
> 407: }
> 408:
> 409: // color buffer or max scalar buffer have a reduced size.
> 410: fragTexCoord = (gl_FragCoord.xy - in_windowLowerLeftCorner) *
> 411: in_inverseOriginalWindowSize;
> 412:
> 413: // Compute max number of iterations it will take before we hit
> 414: // the termination point
> 415:
> 416: // Abscissa of the point on the depth buffer along the ray.
> 417: // point in texture coordinates
> 418: vec4 terminatePoint;
> 419: terminatePoint.x = (gl_FragCoord.x - in_windowLowerLeftCorner.x) *
> 2.0 *
> 420: in_inverseWindowSize.x - 1.0;
> 421: terminatePoint.y = (gl_FragCoord.y - in_windowLowerLeftCorner.y) *
> 2.0 *
> 422: in_inverseWindowSize.y - 1.0;
> 423: terminatePoint.z = (2.0 * l_depthValue.x - (gl_DepthRange.near +
> 424: gl_DepthRange.far)) / gl_DepthRange.diff;
> 425: terminatePoint.w = 1.0;
> 426:
> 427: // From normalized device coordinates to eye coordinates.
> 428: // in_projectionMatrix is inversed because of way VT
> 429: // From eye coordinates to texture coordinates
> 430: terminatePoint = in_inverseTextureDatasetMatrix *
> 431: in_inverseVolumeMatrix *
> 432: in_inverseModelViewMatrix *
> 433: in_inverseProjectionMatrix *
> 434: terminatePoint;
> 435: terminatePoint /= terminatePoint.w;
> 436:
> 437: l_terminatePointMax = length(terminatePoint.xyz - g_dataPos.xyz) /
> 438: length(g_dirStep);
> 439: float l_currentT = 0.0;
> 440:
> 441: //VTK::Shading::Init
> 442:
> 443: //VTK::Cropping::Init
> 444:
> 445: //VTK::Clipping::Init
> 446:
> 447: //VTK::RenderToImage::Init
> 448:
> 449: //VTK::DepthPass::Init
> 450:
> 451: /// For all samples along the ray
> 452: while (!g_exit)
> 453: {
> 454:
> 455: l_skip = false;
> 456:
> 457: //VTK::Cropping::Impl
> 458:
> 459: //VTK::Clipping::Impl
> 460:
> 461: //VTK::BinaryMask::Impl
> 462:
> 463: //VTK::CompositeMask::Impl
> 464:
> 465:
> 466: if (!l_skip)
> 467: {
> 468: vec4 scalar = texture3D(in_volume, g_dataPos);
> 469: scalar.r = scalar.r*in_volume_scale.r + in_volume_bias.r;
> 470: scalar = vec4(scalar.r,scalar.r,scalar.r,scalar.r);
> 471: g_srcColor = vec4(0.0);
> 472: g_srcColor.a = computeOpacity(scalar);
> 473: if (g_srcColor.a > 0.0)
> 474: {
> 475: g_srcColor = computeColor(scalar, g_srcColor.a);
> 476: // Opacity calculation using compositing:
> 477: // Here we use front to back compositing scheme whereby
> 478: // the current sample value is multiplied to the
> 479: // currently accumulated alpha and then this product
> 480: // is subtracted from the sample value to get the
> 481: // alpha from the previous steps. Next, this alpha is
> 482: // multiplied with the current sample colour
> 483: // and accumulated to the composited colour. The alpha
> 484: // value from the previous steps is then accumulated
> 485: // to the composited colour alpha.
> 486: g_srcColor.rgb *= g_srcColor.a;
> 487: g_fragColor = (1.0f - g_fragColor.a) * g_srcColor + g_fragColor;
> 488: }
> 489: }
> 490:
> 491: //VTK::RenderToImage::Impl
> 492:
> 493: //VTK::DepthPass::Impl
> 494:
> 495: /// Advance ray
> 496: g_dataPos += g_dirStep;
> 497:
> 498:
> 499: // sign function performs component wise operation and returns -1
> 500: // if the difference is less than 0, 0 if equal to 0, and 1 if
> 501: // above 0. So if the ray is inside the volume, dot product will
> 502: // always be 3.
> 503: stop = dot(sign(g_dataPos - l_texMin), sign(l_texMax - g_dataPos))
> 504: < 3.0;
> 505:
> 506: // If the stopping condition is true we brek out of the ray marching
> 507: // loop
> 508: if (stop)
> 509: {
> 510: break;
> 511: }
> 512: // Early ray termination
> 513: // if the currently composited colour alpha is already fully
> saturated
> 514: // we terminated the loop or if we have hit an obstacle in the
> 515: // direction of they ray (using depth buffer) we terminate as well.
> 516: if((g_fragColor.a > (1.0 - 1.0/255.0)) ||
> 517: l_currentT >= l_terminatePointMax)
> 518: {
> 519: break;
> 520: }
> 521: ++l_currentT;
> 522: }
> 523:
> 524: //VTK::Base::Exit
> 525:
> 526: //VTK::Terminate::Exit
> 527:
> 528: //VTK::Cropping::Exit
> 529:
> 530: //VTK::Clipping::Exit
> 531:
> 532: //VTK::Shading::Exit
> 533:
> 534: g_fragColor.r = g_fragColor.r * in_scale + in_bias * g_fragColor.a;
> 535: g_fragColor.g = g_fragColor.g * in_scale + in_bias * g_fragColor.a;
> 536: g_fragColor.b = g_fragColor.b * in_scale + in_bias * g_fragColor.a;
> 537: fragOutput0 = g_fragColor;
> 538:
> 539: //VTK::RenderToImage::Exit
> 540:
> 541: //VTK::DepthPass::Exit
> 542: }
> 543:
>
>
>
> ERROR: In Y:\ThirdParty\vtk700\Rendering\OpenGL2\vtkShaderProgram.cxx,
> line 379
> vtkShaderProgram (00000000362FFA50): 0(206) : error C1008: undefined
> variable "g_aspect"
> 0(207) : error C1008: undefined variable "g_aspect"
> 0(208) : error C1008: undefined variable "g_aspect"
> 0(369) : error C1008: undefined variable "g_aspect"
> 0(370) : error C1008: undefined variable "g_aspect"
> 0(371) : error C1008: undefined variable "g_aspect"
>
>
>
> On Apr 04, 2016, at 11:49 AM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
> Yes please. If you can checkout the latest master, this should not happen.
>
> Thanks,
> Aashish
>
> On Mon, Apr 4, 2016 at 11:48 AM, Richard Frank <rickfrank at me.com> wrote:
>
>> No I'm using 7.0.0 release not a git clone.
>>
>> I guess I should get the latest?
>>
>> Rick
>>
>>
>> On Apr 04, 2016, at 10:53 AM, Aashish Chaudhary <
>> aashish.chaudhary at kitware.com> wrote:
>>
>> Thanks, and are you using VTK master as of last week since we had this
>> problem and got fixed recently.
>>
>> - Aashish
>>
>> On Mon, Apr 4, 2016 at 10:47 AM, Richard Frank <rickfrank at me.com> wrote:
>>
>>> Hi,
>>>
>>> Here is a portion of code:
>>>
>>>
>>> volumeProperty->SetColor(0, colorTransferFunction);
>>> volumeProperty->SetColor(1, maskColorTransferFunction);
>>> volumeProperty->SetScalarOpacity(opacityTransferFunction);
>>> volumeProperty->SetGradientOpacity(volumeGradientOpacityFunction);
>>> volumeProperty->SetInterpolationTypeToLinear();
>>> volumeProperty->ShadeOn();
>>> volumeProperty->SetAmbient(0.4);
>>> volumeProperty->SetDiffuse(0.8);
>>> volumeProperty->SetSpecular(0.2);
>>> volumeProperty->SetSpecularPower(105.0);
>>> volumeProperty->SetScalarOpacityUnitDistance(0.7);
>>> volume->SetProperty(volumeProperty);
>>>
>>> The hard coded numbers are just picked empirically by viewing our most
>>> common inputs.
>>>
>>> On Apr 03, 2016, at 10:26 PM, Aashish Chaudhary <
>>> aashish.chaudhary at kitware.com> wrote:
>>>
>>> Rick,
>>>
>>> Can you send me information on what you are turning on in volume
>>> property and in mapper that leads to this crash? Also, is your data is
>>> single or 2 or 4 component?
>>>
>>> Thanks,
>>>
>>>
>>> On Sun, Apr 3, 2016 at 9:25 PM, Richard Frank <rickfrank at me.com> wrote:
>>>
>>>> Further investigation seems to point the GradientOpacity section of
>>>> shader  raycasterfs.glsl, code which seems to be inserted at runtime: I
>>>> guess gl_aspect is not defined in this scenario?
>>>>
>>>> Any suggestions welcome!
>>>>
>>>> Rick
>>>>
>>>> vec4 computeGradient()
>>>> 145: {
>>>> 146: vec3 g1;
>>>> 147: vec4 g2;
>>>> 148: g1.x = texture3D(in_volume, vec3(g_dataPos + g_xvec)).x;
>>>> 149: g1.y = texture3D(in_volume, vec3(g_dataPos + g_yvec)).x;
>>>> 150: g1.z = texture3D(in_volume, vec3(g_dataPos + g_zvec)).x;
>>>> 151: g2.x = texture3D(in_volume, vec3(g_dataPos - g_xvec)).x;
>>>> 152: g2.y = texture3D(in_volume, vec3(g_dataPos - g_yvec)).x;
>>>> 153: g2.z = texture3D(in_volume, vec3(g_dataPos - g_zvec)).x;
>>>> 154: g1 = g1*in_volume_scale.r + in_volume_bias.r;
>>>> 155: g2 = g2*in_volume_scale.r + in_volume_bias.r;
>>>> 156: g1.x = in_scalarsRange[0] + (
>>>> 157: in_scalarsRange[1] - in_scalarsRange[0]) * g1.x;
>>>> 158: g1.y = in_scalarsRange[0] + (
>>>> 159: in_scalarsRange[1] - in_scalarsRange[0]) * g1.y;
>>>> 160: g1.z = in_scalarsRange[0] + (
>>>> 161: in_scalarsRange[1] - in_scalarsRange[0]) * g1.z;
>>>> 162: g2.x = in_scalarsRange[0] + (
>>>> 163: in_scalarsRange[1] - in_scalarsRange[0]) * g2.x;
>>>> 164: g2.y = in_scalarsRange[0] + (
>>>> 165: in_scalarsRange[1] - in_scalarsRange[0]) * g2.y;
>>>> 166: g2.z = in_scalarsRange[0] + (
>>>> 167: in_scalarsRange[1] - in_scalarsRange[0]) * g2.z;
>>>> 168: g2.xyz = g1 - g2.xyz;
>>>> 169: g2.x /= g_aspect.x;
>>>> 170: g2.y /= g_aspect.y;
>>>> 171: g2.z /= g_aspect.z;
>>>> 172: float grad_mag = sqrt(g2.x * g2.x +
>>>> 173: g2.y * g2.y +
>>>> 174: g2.z * g2.z);
>>>> 175: if (grad_mag > 0.0)
>>>> 176: {
>>>> 177: g2.x /= grad_mag;
>>>> 178: g2.y /= grad_mag;
>>>> 179: g2.z /= grad_mag;
>>>> 180: }
>>>> 181: else
>>>> 182: {
>>>> 183: g2.xyz = vec3(0.0, 0.0, 0.0);
>>>> 184: }
>>>> 185: grad_mag = grad_mag * 1.0 / (0.25 * (in_scalarsRange[1] -
>>>> 186: (in_scalarsRange[0])));
>>>> 187: grad_mag = clamp(grad_mag, 0.0, 1.0);
>>>> 188: g2.w = grad_mag;
>>>> 189: return g2;
>>>> 190: }
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>   *
>>> *| http://www.kitware.com/company/team/chaudhary.html
>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>
>>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>> *
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>>
>
>
> --
>
>
>
> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
> *| http://www.kitware.com/company/team/chaudhary.html
> <http://www.kitware.com/company/team/chaudhary.html>*
>
>
>


-- 



*| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
*| http://www.kitware.com/company/team/chaudhary.html
<http://www.kitware.com/company/team/chaudhary.html>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160427/9660a48f/attachment.html>


More information about the vtkusers mailing list