Updated shaders from OpenSceneGraph-Data.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15059 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
687e77ddc9
commit
d205919881
@ -9,7 +9,7 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -61,20 +61,16 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
" float r = color[3]*TransparencyValue;\n"
|
||||
@ -88,7 +84,7 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
@ -99,7 +95,6 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
@ -10,7 +10,7 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -62,16 +62,13 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = te.xyz;\n"
|
||||
"\n"
|
||||
" vec4 previousColor = texture3D( baseTexture, texcoord);\n"
|
||||
@ -81,7 +78,7 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" vec3 deltaY = vec3(0.0, normalSampleDistance, 0.0);\n"
|
||||
" vec3 deltaZ = vec3(0.0, 0.0, normalSampleDistance);\n"
|
||||
" \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
"\n"
|
||||
|
@ -10,7 +10,7 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -62,16 +62,12 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" float normalSampleDistance = 1.0/512.0;\n"
|
||||
@ -80,7 +76,7 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" vec3 deltaZ = vec3(0.0, 0.0, normalSampleDistance);\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
"\n"
|
||||
@ -115,18 +111,17 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= TransparencyValue;\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0;\n"
|
||||
"\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
@ -15,7 +15,7 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -69,16 +69,12 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"\n"
|
||||
" vec3 eyeDirection = normalize((te-t0).xyz);\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" float normalSampleDistance = 1.0/512.0;\n"
|
||||
@ -87,7 +83,7 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" vec3 deltaZ = vec3(0.0, 0.0, normalSampleDistance);\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" float v = texture3D( baseTexture, texcoord).a * tfScale + tfOffset;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
@ -112,7 +108,6 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" color.z *= lightScale;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" float r = color[3]*TransparencyValue;\n"
|
||||
" if (r>AlphaFuncValue)\n"
|
||||
" {\n"
|
||||
@ -124,7 +119,7 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
|
@ -9,7 +9,7 @@ char volume_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -61,38 +61,33 @@ char volume_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
" if (fragColor.w<color.w)\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= TransparencyValue;\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0;\n"
|
||||
"\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
@ -14,7 +14,7 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -66,20 +66,16 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" float v = texture3D( baseTexture, texcoord).a * tfScale + tfOffset;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
@ -95,7 +91,7 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
@ -106,7 +102,6 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
@ -15,7 +15,7 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@ -67,16 +67,13 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions)\n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = te.xyz;\n"
|
||||
" float previousV = texture3D( baseTexture, texcoord).a;\n"
|
||||
"\n"
|
||||
@ -84,8 +81,8 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" vec3 deltaX = vec3(normalSampleDistance, 0.0, 0.0);\n"
|
||||
" vec3 deltaY = vec3(0.0, normalSampleDistance, 0.0);\n"
|
||||
" vec3 deltaZ = vec3(0.0, 0.0, normalSampleDistance);\n"
|
||||
"\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" \n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
"\n"
|
||||
" float v = texture3D( baseTexture, texcoord).a;\n"
|
||||
@ -134,6 +131,5 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"\n"
|
||||
" // we didn't find an intersection so just discard fragment\n"
|
||||
" discard;\n"
|
||||
"\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
@ -66,20 +66,16 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const int max_iteratrions = 2048;\n"
|
||||
" int num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2) num_iterations = 2;\n"
|
||||
" if (num_iterations>max_iteratrions) num_iterations = max_iteratrions;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions)\n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" while(num_iterations>0)\n"
|
||||
" {\n"
|
||||
" float v = texture3D( baseTexture, texcoord).s * tfScale + tfOffset;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
|
Loading…
Reference in New Issue
Block a user