Offset sample coordinate by 0.5 when estimating height values (#2769)

* Offset sample coordinate by 0.5 when estimating height values
This commit is contained in:
Emma Broman
2023-06-22 11:08:52 +02:00
committed by GitHub
parent 89d130dcd5
commit c424783b50

View File

@@ -1436,7 +1436,6 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
const glm::dmat4 viewTransform = data.camera.combinedViewMatrix();
const glm::dmat4 modelViewTransform = viewTransform * _cachedModelTransform;
std::array<glm::dvec3, 4> cornersCameraSpace;
std::array<glm::dvec3, 4> cornersModelSpace;
for (int i = 0; i < 4; ++i) {
@@ -1992,7 +1991,12 @@ float RenderableGlobe::getHeight(const glm::dvec3& position) const {
const glm::uvec3 dimensions = tileTexture->dimensions();
const glm::vec2 samplePos = transformedUv * glm::vec2(dimensions);
glm::vec2 samplePos = transformedUv * glm::vec2(dimensions);
// @TODO (emmbr, 2023-06-14) This 0.5f offset was added as a bandaid for issue
// #2696. It seems to improve the behavior, but I am not certain of why. And the
// underlying problem is still there and should at some point be looked at again
samplePos -= glm::vec2(0.5f);
glm::uvec2 samplePos00 = samplePos;
samplePos00 = glm::clamp(
samplePos00,