Removed old shader files
This commit is contained in:
parent
f9855c35ec
commit
8c134750e6
@ -1,99 +0,0 @@
|
||||
char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\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"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
" float r = color[3]*transparency;\n"
|
||||
" if (r>alphaCutOff)\n"
|
||||
" {\n"
|
||||
" fragColor.xyz = fragColor.xyz*(1.0-r)+color.xyz*r;\n"
|
||||
" fragColor.w += r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (fragColor.w<color.w)\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= transparency;\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w<alphaCutOff) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,134 +0,0 @@
|
||||
char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"\n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" vec3 eyeDirection = normalize(te-t0);\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(t0-te)/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = te;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" vec4 previousColor = texture3D( baseTexture, texcoord);\n"
|
||||
" \n"
|
||||
" float normalSampleDistance = 1.0/512.0;\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"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
"\n"
|
||||
" float m = (previousColor.a-alphaCutOff) * (color.a-alphaCutOff);\n"
|
||||
" if (m <= 0.0)\n"
|
||||
" {\n"
|
||||
" float r = (alphaCutOff-color.a)/(previousColor.a-color.a);\n"
|
||||
" texcoord = texcoord - r*deltaTexCoord;\n"
|
||||
" \n"
|
||||
" float a = color.a;\n"
|
||||
" float px = texture3D( baseTexture, texcoord + deltaX).a;\n"
|
||||
" float py = texture3D( baseTexture, texcoord + deltaY).a;\n"
|
||||
" float pz = texture3D( baseTexture, texcoord + deltaZ).a;\n"
|
||||
"\n"
|
||||
" float nx = texture3D( baseTexture, texcoord - deltaX).a;\n"
|
||||
" float ny = texture3D( baseTexture, texcoord - deltaY).a;\n"
|
||||
" float nz = texture3D( baseTexture, texcoord - deltaZ).a;\n"
|
||||
" \n"
|
||||
" vec3 grad = vec3(px-nx, py-ny, pz-nz);\n"
|
||||
" vec3 normal = normalize(grad);\n"
|
||||
"\n"
|
||||
" float lightScale = 0.1 + abs(dot(normal.xyz, eyeDirection))*0.9;\n"
|
||||
" \n"
|
||||
" \n"
|
||||
"#if 0\n"
|
||||
" color.x *= lightScale;\n"
|
||||
" color.y *= lightScale;\n"
|
||||
" color.z *= lightScale;\n"
|
||||
"#else\n"
|
||||
" color.x = lightScale;\n"
|
||||
" color.y = lightScale;\n"
|
||||
" color.z = lightScale;\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
" fragColor = vec4(lightScale, lightScale, lightScale, 1.0);\n"
|
||||
" \n"
|
||||
" break;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" previousColor = color;\n"
|
||||
" \n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" //if (fragColor.w<alphaCutOff) discard;\n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,92 +0,0 @@
|
||||
char volume_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\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"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
" if (fragColor.w<color.w)\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= transparency;\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w<alphaCutOff) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,120 +0,0 @@
|
||||
char volume_n_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform sampler3D normalMap;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"\n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" vec3 eyeDirection = normalize(te-t0);\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\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"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" vec4 normal = texture3D( normalMap, texcoord);\n"
|
||||
"#if 1\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
"\n"
|
||||
" normal.x = normal.x*2.0-1.0;\n"
|
||||
" normal.y = normal.y*2.0-1.0;\n"
|
||||
" normal.z = normal.z*2.0-1.0;\n"
|
||||
" \n"
|
||||
" float lightScale = 0.1 + max(dot(normal.xyz, eyeDirection), 0.0);\n"
|
||||
" color.x *= lightScale;\n"
|
||||
" color.y *= lightScale;\n"
|
||||
" color.z *= lightScale;\n"
|
||||
"\n"
|
||||
" float r = normal[3]*transparency;\n"
|
||||
"#else\n"
|
||||
" vec4 color = texture3D( normalMap, texcoord);\n"
|
||||
" color.x = color.x*2.0 - 1.0;\n"
|
||||
" color.y = color.y*2.0 - 1.0;\n"
|
||||
" color.z = color.z*2.0 - 1.0;\n"
|
||||
" \n"
|
||||
" float lightScale = 0.1 + max(dot(color.xyz, eyeDirection), 0.0);\n"
|
||||
" color.x = lightScale;\n"
|
||||
" color.y = lightScale;\n"
|
||||
" color.z = lightScale;\n"
|
||||
"\n"
|
||||
" float r = color[3]*transparency;\n"
|
||||
"#endif \n"
|
||||
" if (r>alphaCutOff)\n"
|
||||
" {\n"
|
||||
" fragColor.xyz = fragColor.xyz*(1.0-r)+color.xyz*r;\n"
|
||||
" fragColor.w += r;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w==0.0) discard;\n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,102 +0,0 @@
|
||||
char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform sampler1D tfTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\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"
|
||||
"\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).a;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
"\n"
|
||||
" float r = color[3]*transparency;\n"
|
||||
" if (r>alphaCutOff)\n"
|
||||
" {\n"
|
||||
" fragColor.xyz = fragColor.xyz*(1.0-r)+color.xyz*r;\n"
|
||||
" fragColor.w += r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (fragColor.w<color.w)\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= transparency;\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w<alphaCutOff) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,129 +0,0 @@
|
||||
char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform sampler1D tfTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" vec3 eyeDirection = normalize(te-t0);\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" \n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(t0-te)/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = te;\n"
|
||||
" float previousV = texture3D( baseTexture, texcoord).a;\n"
|
||||
"\n"
|
||||
" float normalSampleDistance = 1.0/512.0;\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"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
"\n"
|
||||
" float v = texture3D( baseTexture, texcoord).a;\n"
|
||||
"\n"
|
||||
" float m = (previousV-alphaCutOff) * (v-alphaCutOff);\n"
|
||||
" if (m <= 0.0)\n"
|
||||
" {\n"
|
||||
" float r = (alphaCutOff-v)/(previousV-v);\n"
|
||||
" texcoord = texcoord - r*deltaTexCoord;\n"
|
||||
"\n"
|
||||
" v = texture3D( baseTexture, texcoord).a;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
"\n"
|
||||
" float px = texture3D( baseTexture, texcoord + deltaX).a;\n"
|
||||
" float py = texture3D( baseTexture, texcoord + deltaY).a;\n"
|
||||
" float pz = texture3D( baseTexture, texcoord + deltaZ).a;\n"
|
||||
"\n"
|
||||
" float nx = texture3D( baseTexture, texcoord - deltaX).a;\n"
|
||||
" float ny = texture3D( baseTexture, texcoord - deltaY).a;\n"
|
||||
" float nz = texture3D( baseTexture, texcoord - deltaZ).a;\n"
|
||||
" \n"
|
||||
" vec3 grad = vec3(px-nx, py-ny, pz-nz);\n"
|
||||
" vec3 normal = normalize(grad);\n"
|
||||
"\n"
|
||||
" float lightScale = 0.1 + abs(dot(normal.xyz, eyeDirection))*0.9;\n"
|
||||
" \n"
|
||||
" color.x *= lightScale;\n"
|
||||
" color.y *= lightScale;\n"
|
||||
" color.z *= lightScale;\n"
|
||||
"\n"
|
||||
" fragColor = color;\n"
|
||||
" \n"
|
||||
" break;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" previousV = v;\n"
|
||||
" \n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w<alphaCutOff) discard;\n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,93 +0,0 @@
|
||||
char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform sampler1D tfTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\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"
|
||||
"\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;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
" if (fragColor.w<color.w)\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= transparency;\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w<alphaCutOff) discard;\n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,107 +0,0 @@
|
||||
char volume_tf_n_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"uniform sampler3D normalMap;\n"
|
||||
"uniform sampler1D tfTexture;\n"
|
||||
"uniform float sampleDensity;\n"
|
||||
"uniform float transparency;\n"
|
||||
"uniform float alphaCutOff;\n"
|
||||
"\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"\n"
|
||||
" vec3 eyeDirection = normalize(te-t0);\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
" te.z>=0.0 && te.z<=1.0)\n"
|
||||
" {\n"
|
||||
" // do nothing... te inside volume\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" if (te.x<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.x / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.x>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.x) / (t0.x-te.x);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.y / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.y>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.y) / (t0.y-te.y);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z<0.0)\n"
|
||||
" {\n"
|
||||
" float r = -te.z / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (te.z>1.0)\n"
|
||||
" {\n"
|
||||
" float r = (1.0-te.z) / (t0.z-te.z);\n"
|
||||
" te = te + (t0-te)*r;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/sampleDensity);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\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"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" vec4 normal = texture3D( normalMap, texcoord);\n"
|
||||
" float v = normal.a; // texture3D( baseTexture, texcoord).s;\n"
|
||||
" vec4 color = texture1D( tfTexture, v);\n"
|
||||
"\n"
|
||||
" normal.x = normal.x*2.0-1.0;\n"
|
||||
" normal.y = normal.y*2.0-1.0;\n"
|
||||
" normal.z = normal.z*2.0-1.0;\n"
|
||||
" \n"
|
||||
" float lightScale = 0.1 + max(dot(normal.xyz, eyeDirection), 0.0);\n"
|
||||
" color.x *= lightScale;\n"
|
||||
" color.y *= lightScale;\n"
|
||||
" color.z *= lightScale;\n"
|
||||
"\n"
|
||||
" float r = normal[3]*transparency;\n"
|
||||
" if (r>alphaCutOff)\n"
|
||||
" {\n"
|
||||
" fragColor.xyz = fragColor.xyz*(1.0-r)+color.xyz*r;\n"
|
||||
" fragColor.w += r;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w==0.0) discard;\n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
@ -1,17 +0,0 @@
|
||||
char volume_vert[] = "#version 110\n"
|
||||
"varying vec4 cameraPos;\n"
|
||||
"varying vec4 vertexPos;\n"
|
||||
"varying mat4 texgen;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_Position = ftransform();\n"
|
||||
"\n"
|
||||
" cameraPos = gl_ModelViewMatrixInverse*vec4(0,0,0,1);\n"
|
||||
" vertexPos = gl_Vertex;\n"
|
||||
"\n"
|
||||
" texgen = mat4(gl_ObjectPlaneS[0], \n"
|
||||
" gl_ObjectPlaneT[0],\n"
|
||||
" gl_ObjectPlaneR[0],\n"
|
||||
" gl_ObjectPlaneQ[0]);\n"
|
||||
"}\n";
|
Loading…
Reference in New Issue
Block a user