BTW, pleased to meet you Harry! Great contributions

ConversusVans wrote:Doesn't Harley use microtextures? I have a feeling that game does use them in the Beverly Hills fountain area and the UFO dome area of Hollywood.
// https://www.opengl.org/discussion_boards/showthread.php/177520-Mipmap-level-calculation-using-dFdx-dFdy
float getMipLevel(in vec2 coord, in const sampler2D tex) // in texel units
{
vec2 texSize = textureSize(tex, 0); // get the size of LOD 0
coord = coord * texSize;
vec2 dx_vtc = dFdx(coord);
vec2 dy_vtc = dFdy(coord);
float delta_max_sqr = max(dot(dx_vtc, dx_vtc), dot(dy_vtc, dy_vtc));
float mml = max(0.0, 0.5 * log2(delta_max_sqr) - 1.0); // == log2(sqrt(delta_max_sqr));
return mml;
}
float lod, lodBias, blendFactor;
lodBias = -1.0;
lod = getMipLevel(vs.coord.st, tex1) + lodBias; // tex1 is the base-texture
lod = max(0.0, lod);
lod = min(5.0, lod);
blendFactor = min(one, 0.5 + lod * 0.5);
finalTexture.rgb = mix(microTexture.rgb, baseTexture.rgb, blendFactor);
Ian wrote:I should probably add, you will see exactly this without an-isotrophic filtering
maxAnistrophy = 1.0f; // Disable anisotropic filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -2.2f);
Ian wrote:The reference image is kind of odd. Looks like anisotrophic filtering, the lines remain sharp. Maybe the microtextures don't use this
Users browsing this forum: No registered users and 1 guest