Fixed error in the computation of tex coords of Maximum Intensity Projection + Transfer Function rendering.
This commit is contained in:
@@ -14,9 +14,9 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
@@ -63,19 +63,22 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/SampleDensityValue);\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" \n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions)\n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0)/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0;\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" float v = texture3D( baseTexture, texcoord).s * tfScale + tfOffset;\n"
|
||||
@@ -84,7 +87,7 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
|
||||
Reference in New Issue
Block a user