diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl index 4fe43ac40f..6a9adba241 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl @@ -82,6 +82,8 @@ Fragment getFragment() { ColorTexturesParent1, ColorTexturesParent2); +#else + frag.color = calculateDebugColor(fs_uv, fs_position); #endif // USE_COLORTEXTURE #if USE_GRAYSCALE_OVERLAY diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl index 75300fa530..b73ce69a7e 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl @@ -54,7 +54,6 @@ layout(location = 1) in vec2 in_uv; out vec2 fs_uv; out vec4 fs_position; out vec3 ellipsoidNormalCameraSpace; - out LevelWeights levelWeights; PositionNormalPair globalInterpolation() { diff --git a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl index 0c1dd5a26a..7a93dbe4df 100644 --- a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl @@ -78,9 +78,11 @@ Fragment getFragment() { ColorTextures, ColorTexturesParent1, ColorTexturesParent2); - +#else + frag.color = calculateDebugColor(fs_uv, fs_position); #endif // USE_COLORTEXTURE + #if USE_GRAYSCALE_OVERLAY frag.color = calculateGrayScaleOverlay( diff --git a/modules/globebrowsing/shaders/texturetilemapping.hglsl b/modules/globebrowsing/shaders/texturetilemapping.hglsl index 81684d5e52..5b9a139618 100644 --- a/modules/globebrowsing/shaders/texturetilemapping.hglsl +++ b/modules/globebrowsing/shaders/texturetilemapping.hglsl @@ -63,7 +63,7 @@ #define SHOW_CHUNK_EDGES #{showChunkEdges} float calculateHeight( - const vec2 uv, + vec2 uv, LevelWeights levelWeights, const Tile heightTiles[NUMLAYERS_HEIGHTMAP], const Tile heightTilesParent1[NUMLAYERS_HEIGHTMAP], @@ -77,6 +77,8 @@ float calculateHeight( levelWeights = getDefaultLevelWeights(); #endif // HEIGHTMAP_BLENDING_ENABLED + uv = (65.0 / 65.0) * uv; + #for i in 0..#{lastLayerIndexHeightMaps} { float untransformedHeight = @@ -121,6 +123,26 @@ vec4 calculateColor( return color; } +float gridDots(vec2 uv, vec2 gridResolution){ + vec2 uvVertexSpace = fract(gridResolution * uv); + + vec2 uvDotSpace = abs(2*(uvVertexSpace-0.5)); + return 1-length(1-uvDotSpace); +} + +vec4 calculateDebugColor(vec2 uv, vec4 fragPos){ + vec2 vertexResolution = vec2(64.0); + vec2 uvVertexSpace = fract(vertexResolution * uv); + + vec3 colorUv = vec3(0.3*uv.x, 0.3*uv.y, 0); + vec3 colorDistance = vec3(0, 0, 0.4*log(fragPos.w) - 3.9); + vec3 colorVertex = (1.0-length(uvVertexSpace)) * vec3(0.5); + vec3 colorHeightSample = (gridDots(uv, vertexResolution) > 0.9 ? 1 : 0) * vec3(1,0,0); + return vec4(colorUv + colorDistance + colorVertex + colorHeightSample, 1); +} + + + vec4 calculateNight( const vec4 currentColor, const vec2 uv,