From 2b2c3166e4d90f7667e5130bace67f4946fb00a5 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Tue, 10 May 2016 13:29:07 -0400 Subject: [PATCH] Height mapping for chunked lod globe. --- modules/globebrowsing/globes/chunklodglobe.cpp | 4 ++-- modules/globebrowsing/globes/chunknode.cpp | 2 +- modules/globebrowsing/globes/renderableglobe.cpp | 2 +- modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl | 2 +- modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/globebrowsing/globes/chunklodglobe.cpp b/modules/globebrowsing/globes/chunklodglobe.cpp index fac036280f..b3c70b0076 100644 --- a/modules/globebrowsing/globes/chunklodglobe.cpp +++ b/modules/globebrowsing/globes/chunklodglobe.cpp @@ -58,8 +58,8 @@ namespace openspace { , maxSplitDepth(22) { auto geometry = std::shared_ptr(new BasicGrid( - 10, - 10, + 256, + 256, TriangleSoup::Positions::No, TriangleSoup::TextureCoordinates::Yes, TriangleSoup::Normals::No)); diff --git a/modules/globebrowsing/globes/chunknode.cpp b/modules/globebrowsing/globes/chunknode.cpp index 641456d3ba..6ff11f9d46 100644 --- a/modules/globebrowsing/globes/chunknode.cpp +++ b/modules/globebrowsing/globes/chunknode.cpp @@ -204,7 +204,7 @@ int ChunkNode::calculateDesiredLevelAndUpdateIsVisible( Scalar distance = glm::length(cameraToChunk); _owner.minDistToCamera = fmin(_owner.minDistToCamera, distance); - Scalar scaleFactor = 100 * minimumGlobeRadius; + Scalar scaleFactor = 10 * minimumGlobeRadius; Scalar projectedScaleFactor = scaleFactor / distance; int desiredLevel = floor( log2(projectedScaleFactor) ); return desiredLevel; diff --git a/modules/globebrowsing/globes/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp index 2795a0d571..343f9d8aa2 100644 --- a/modules/globebrowsing/globes/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -93,7 +93,7 @@ namespace openspace { heightMapDictionary.getValue("FilePath", path); std::shared_ptr heightMapProvider = std::shared_ptr(new TileProvider( - path, 5000, 512)); + path, 5000, 256)); _tileProviderManager->addHeightMap(name, heightMapProvider); } diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl index 8652a9a144..5a2b69a3ec 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl @@ -55,7 +55,7 @@ Fragment getFragment() { //frag.color = frag.color * 0.9 + 0.2*vec4(samplePos, 0, 1); // Border overlay - frag.color = frag.color + borderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02); + frag.color = frag.color;// + borderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02); frag.depth = vs_position.w; diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl index 813a3f1f89..b712c77ba7 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl @@ -57,7 +57,7 @@ void main() vec2 samplePos = heightSamplingScale*in_UV + heightSamplingOffset; float sampledHeight = texture(textureSamplerHeight, samplePos).r; - pair.position += pair.normal * sampledHeight * 1e1; + pair.position += pair.normal * sampledHeight * pow(2,15); vec4 position = modelViewProjectionTransform * vec4(pair.position, 1);