Here's the GLSL function copied directly from the Google I/O talk
vec4 sampleAs3DTexture(sampler2D tex, vec3 texCoord, float size) {
float sliceSize = 1.0 / size; // space of 1 slice
float slicePixelSize = sliceSize / size; // space of 1 pixel
float sliceInnerSize = slicePixelSize * (size - 1.0); // space of size pixels
float zSlice0 = min(floor(texCoord.z * size), size - 1.0);
float zSlice1 = min(zSlice0 + 1.0, size - 1.0);
float xOffset = slicePixelSize * 0.5 + texCoord.x * sliceInnerSize;
float s0 = xOffset + (zSlice0 * sliceSize);
float s1 = xOffset + (zSlice1 * sliceSize);
vec4 slice0Color = texture2D(tex, vec2(s0, texCoord.y));
vec4 slice1Color = texture2D(tex, vec2(s1, texCoord.y));
float zOffset = mod(texCoord.z * size, 1.0);
return mix(slice0Color, slice1Color, zOffset);
}
https://code.google.com/p/webglsamples/source/browse/color-adjust/color-adjust.html
If you want a 8x8x8 3D texture you'd make 64x8 texture and put each slice of the cube across the texture
[slice0][slice1][slice2]....[slice7]
Then make a sampler2D uniform in your shader and call
sampleAs3DTexture(yourSampler, your3DTexCoord, size)
where size
the size of your cube (in the example size = 8)