Closed nopjia closed 12 years ago
I'm implementing this, but this in fact is not the root of the problem. The cause for the black rims is GL linear interpolation.
as for the GL linear interpolation there are some ideas me and Ian had that use either the voxelizer or mipmapper stage to somehow write sorrounding voxels that have the same color but alpha of 0. And then interp isnt a problem.
yup. that would be the solution. as to how, we'll have to discuss.
I just did a few tests. Performance took a hit (as expected), and there is no visible difference. I'm closing this issue we irrelevant and unnecessary.
I'll paste the code snippet here in case we'd need it later.
// get average value between two mips
vec4 texel;
if (pixSize > gTexelSize) {
float mipLevel = log2(pixSize/gTexelSize);
float mipLevelFloor = floor(mipLevel);
float mipLevelFract = fract(mipLevel);
vec4 texelFloor = textureLod(tVoxColor, pos, mipLevelFloor);
vec4 texelCeil = textureLod(tVoxColor, pos, mipLevelFloor+1.0);
float sumAlpha = texelFloor.a+texelCeil.a;
if (sumAlpha != 0.0) {
texel = vec4( (texelFloor.rgb+texelCeil.rgb)/(sumAlpha), sumAlpha/2.0);
}
}
else {
texel = textureLod(tVoxColor, pos, 0.0);
pixSize = gTexelSize;
}
yeah i think the linear is more important as far as the black borders goes
the padding thing is similar to what i did manually with the rainbow sphere example we had. thats why it does not have black edges. disabling linear is definitely not an option since we need that to produce any kind of decent image.
but what i'm saying here is, we don't need manual mipmap interp when reading, since it produced no visual difference.
So there is no black outlines when color fades to alpha for cone tracing.