Failed experiment with anisotropic filtering.

This commit is contained in:
Kalle Bladin
2016-06-05 12:55:00 -04:00
parent cc31082eff
commit 9d59c25310
5 changed files with 65 additions and 3 deletions

View File

@@ -167,9 +167,11 @@ namespace openspace {
tileData->glType,
Texture::FilterMode::Linear,
Texture::WrappingMode::ClampToEdge);
// The texture should take ownership of the data
std::shared_ptr<Texture> texture = std::shared_ptr<Texture>(texturePtr);
//texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
texture->uploadTexture();
MetaTexture metaTexture = { texture, tileIOResult->error };

View File

@@ -59,10 +59,28 @@ Fragment getFragment() {
colorTilesParent2[#{i}].uvTransform.uvScale * fs_uv +
colorTilesParent2[#{i}].uvTransform.uvOffset;
/*
vec4 colorSample =
w1 * textureLod(colorTiles[#{i}].textureSampler, samplePos, 0) +
w2 * textureLod(colorTilesParent1[#{i}].textureSampler, samplePosParent1, 0) +
w3 * textureLod(colorTilesParent2[#{i}].textureSampler, samplePosParent2, 0);
*/
/*
vec4 colorSample =
w1 * textureGrad(colorTiles[#{i}].textureSampler, samplePos, vec2(0), vec2(0)) +
w2 * textureGrad(colorTilesParent1[#{i}].textureSampler, samplePosParent1, vec2(0), vec2(0)) +
w3 * textureGrad(colorTilesParent2[#{i}].textureSampler, samplePosParent2, vec2(0), vec2(0));
*/
vec4 colorSample =
w1 * texture(colorTiles[#{i}].textureSampler, samplePos) +
w2 * texture(colorTilesParent1[#{i}].textureSampler, samplePosParent1) +
w3 * texture(colorTilesParent2[#{i}].textureSampler, samplePosParent2);
frag.color = blendOver(frag.color, colorSample);
}
#endfor

View File

@@ -93,11 +93,25 @@ void main()
heightTilesParent2[#{i}].uvTransform.uvScale * in_uv +
heightTilesParent2[#{i}].uvTransform.uvOffset;
/*
float sampledValue =
w1 * textureLod(heightTiles[#{i}].textureSampler, samplePos, 0).r +
w2 * textureLod(heightTilesParent1[#{i}].textureSampler, samplePosParent1, 0).r +
w3 * textureLod(heightTilesParent2[#{i}].textureSampler, samplePosParent2, 0).r;
*/
/*
float sampledValue =
w1 * textureGrad(heightTiles[#{i}].textureSampler, samplePos, vec2(0), vec2(0)).r +
w2 * textureGrad(heightTilesParent1[#{i}].textureSampler, samplePosParent1, vec2(0), vec2(0)).r +
w3 * textureGrad(heightTilesParent2[#{i}].textureSampler, samplePosParent2, vec2(0), vec2(0)).r;
*/
float sampledValue =
w1 * texture(heightTiles[#{i}].textureSampler, samplePos).r +
w2 * texture(heightTilesParent1[#{i}].textureSampler, samplePosParent1).r +
w3 * texture(heightTilesParent2[#{i}].textureSampler, samplePosParent2).r;
// TODO : Some kind of blending here. Now it just writes over
height = (sampledValue *
heightTiles[#{i}].depthTransform.depthScale +

View File

@@ -61,10 +61,24 @@ Fragment getFragment() {
colorTilesParent2[#{i}].uvTransform.uvScale * fs_uv +
colorTilesParent2[#{i}].uvTransform.uvOffset;
/*
vec4 colorSample =
w1 * textureLod(colorTiles[#{i}].textureSampler, samplePos, 0) +
w2 * textureLod(colorTilesParent1[#{i}].textureSampler, samplePosParent1, 0) +
w3 * textureLod(colorTilesParent2[#{i}].textureSampler, samplePosParent2, 0);
*/
vec4 colorSample =
w1 * texture(colorTiles[#{i}].textureSampler, samplePos) +
w2 * texture(colorTilesParent1[#{i}].textureSampler, samplePosParent1) +
w3 * texture(colorTilesParent2[#{i}].textureSampler, samplePosParent2);
/*
vec4 colorSample =
w1 * textureGrad(colorTiles[#{i}].textureSampler, samplePos, vec2(0), vec2(0)) +
w2 * textureGrad(colorTilesParent1[#{i}].textureSampler, samplePosParent1, vec2(0), vec2(0)) +
w3 * textureGrad(colorTilesParent2[#{i}].textureSampler, samplePosParent2, vec2(0), vec2(0));
*/
frag.color = blendOver(frag.color, colorSample);
}
#endfor

View File

@@ -96,11 +96,25 @@ void main()
heightTilesParent2[#{i}].uvTransform.uvScale * in_uv +
heightTilesParent2[#{i}].uvTransform.uvOffset;
/*
float sampledValue =
w1 * textureLod(heightTiles[#{i}].textureSampler, samplePos, 0).r +
w2 * textureLod(heightTilesParent1[#{i}].textureSampler, samplePosParent1, 0).r +
w3 * textureLod(heightTilesParent2[#{i}].textureSampler, samplePosParent2, 0).r;
*/
/*
float sampledValue =
w1 * textureGrad(heightTiles[#{i}].textureSampler, samplePos, vec2(1), vec2(1)).r +
w2 * textureGrad(heightTilesParent1[#{i}].textureSampler, samplePosParent1, vec2(1), vec2(1)).r +
w3 * textureGrad(heightTilesParent2[#{i}].textureSampler, samplePosParent2, vec2(1), vec2(1)).r;
*/
float sampledValue =
w1 * texture(heightTiles[#{i}].textureSampler, samplePos).r +
w2 * texture(heightTilesParent1[#{i}].textureSampler, samplePosParent1).r +
w3 * texture(heightTilesParent2[#{i}].textureSampler, samplePosParent2).r;
// TODO : Some kind of blending here. Now it just writes over
height = (sampledValue *
heightTiles[#{i}].depthTransform.depthScale +