From 4f1fe0dd49d6937f12c730b0a387486172872790 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 17 Aug 2016 11:25:29 +0200 Subject: [PATCH 01/12] Add optional image dilation to the ProjectionComponent --- data/scene/rosetta/67P/67P.mod | 1 + modules/newhorizons/shaders/dilation_fs.glsl | 77 ++++++++++ modules/newhorizons/shaders/dilation_vs.glsl | 34 +++++ .../shaders/renderableModel_fs.glsl | 6 +- .../renderablePlanetProjection_vs.glsl | 2 - .../newhorizons/util/projectioncomponent.cpp | 142 +++++++++++++++++- .../newhorizons/util/projectioncomponent.h | 17 +++ 7 files changed, 267 insertions(+), 12 deletions(-) create mode 100644 modules/newhorizons/shaders/dilation_fs.glsl create mode 100644 modules/newhorizons/shaders/dilation_vs.glsl diff --git a/data/scene/rosetta/67P/67P.mod b/data/scene/rosetta/67P/67P.mod index a6ec406f4c..209304b8e1 100644 --- a/data/scene/rosetta/67P/67P.mod +++ b/data/scene/rosetta/67P/67P.mod @@ -28,6 +28,7 @@ return { Observer = "ROSETTA", Target = "CHURYUMOV-GERASIMENKO", Aberration = "NONE", + TextureMap = true }, DataInputTranslation = { Instrument = { diff --git a/modules/newhorizons/shaders/dilation_fs.glsl b/modules/newhorizons/shaders/dilation_fs.glsl new file mode 100644 index 0000000000..e9080e13b4 --- /dev/null +++ b/modules/newhorizons/shaders/dilation_fs.glsl @@ -0,0 +1,77 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#version __CONTEXT__ + +in vec2 vs_uv; +out vec4 color; + +uniform sampler2D tex; + +vec2 offsets[8] = { + vec2(-1.0, -1.0), + vec2(-1.0, 0.0), + vec2(-1.0, 1.0), + vec2(0.0, -1.0), + vec2(0.0, 1.0), + vec2(1.0, -1.0), + vec2(1.0, 0.0), + vec2(1.0, 1.0) +}; + +vec3 gatherColors(vec2 position) { + vec2 texSize = textureSize(tex, 0); + vec2 h = vec2(1.0) / texSize; + + int nContributions = 0; + vec3 totalColor = vec3(0.0); + + vec4 colors[8]; + for (int i = 0; i < 8; i++) { + colors[i] = texture(tex, position + h * offsets[i]); + + if (colors[i].a != 0.0) { + totalColor.rgb += colors[i].rgb; + nContributions++; + } + } + + return totalColor / nContributions; +} + +void main() { + vec4 c = texture(tex, vs_uv); + + if (c.a == 0.0) { + // This means that the current fragment/texel we are looking at has not been + // projected on and we only want to do the dilation into these texels + + color = vec4(gatherColors(vs_uv), 0.0); + } + else { + // We are in a region where an image has been projected, so we can reuse the + // already sampled version + color = c; + } +} \ No newline at end of file diff --git a/modules/newhorizons/shaders/dilation_vs.glsl b/modules/newhorizons/shaders/dilation_vs.glsl new file mode 100644 index 0000000000..2efb3027e4 --- /dev/null +++ b/modules/newhorizons/shaders/dilation_vs.glsl @@ -0,0 +1,34 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#version __CONTEXT__ + +layout(location = 0) in vec2 in_position; + +out vec2 vs_uv; + +void main() { + vs_uv = (in_position + vec2(1.0)) / vec2(2.0); + gl_Position = vec4(in_position, 0.0, 1.0); +} diff --git a/modules/newhorizons/shaders/renderableModel_fs.glsl b/modules/newhorizons/shaders/renderableModel_fs.glsl index 8b42731ec2..d90d70e350 100644 --- a/modules/newhorizons/shaders/renderableModel_fs.glsl +++ b/modules/newhorizons/shaders/renderableModel_fs.glsl @@ -70,13 +70,13 @@ Fragment getFragment() { vec4 textureColor = texture(baseTexture, vs_st); vec4 projectionColor = texture(projectionTexture, vs_st); - if (projectionColor.a != 0.0) { + // if (projectionColor.a != 0.0) { textureColor.rgb = mix( textureColor.rgb, projectionColor.rgb, - min(_projectionFading, projectionColor.a) + _projectionFading ); - } + // } Fragment frag; frag.color = max(intensity * textureColor, ambient); diff --git a/modules/newhorizons/shaders/renderablePlanetProjection_vs.glsl b/modules/newhorizons/shaders/renderablePlanetProjection_vs.glsl index 6db9f30f55..d709738859 100644 --- a/modules/newhorizons/shaders/renderablePlanetProjection_vs.glsl +++ b/modules/newhorizons/shaders/renderablePlanetProjection_vs.glsl @@ -24,8 +24,6 @@ #version __CONTEXT__ -#include "PowerScaling/powerScaling_vs.hglsl" - layout(location = 0) in vec4 in_position; out vec4 vs_position; diff --git a/modules/newhorizons/util/projectioncomponent.cpp b/modules/newhorizons/util/projectioncomponent.cpp index 56548b1d88..7b78bb8f05 100644 --- a/modules/newhorizons/util/projectioncomponent.cpp +++ b/modules/newhorizons/util/projectioncomponent.cpp @@ -52,6 +52,8 @@ namespace { const std::string keySequenceType = "Projection.SequenceType"; const std::string keyTranslation = "DataInputTranslation"; + const std::string keyNeedsTextureMapDilation = "Projection.TextureMap"; + const std::string sequenceTypeImage = "image-sequence"; const std::string sequenceTypePlaybook = "playbook"; const std::string sequenceTypeHybrid = "hybrid"; @@ -72,6 +74,7 @@ ProjectionComponent::ProjectionComponent() , _clearAllProjections("clearAllProjections", "Clear Projections", false) , _projectionFading("projectionFading", "Projection Fading", 1.f, 0.f, 1.f) , _projectionTexture(nullptr) + , _needsTextureMapDilation(false) { setName("ProjectionComponent"); @@ -98,6 +101,42 @@ bool ProjectionComponent::initialize() { } _placeholderTexture = std::move(texture); + + if (_needsTextureMapDilation) { + _dilation.program = ghoul::opengl::ProgramObject::Build( + "Dilation", + "${MODULE_NEWHORIZONS}/shaders/dilation_vs.glsl", + "${MODULE_NEWHORIZONS}/shaders/dilation_fs.glsl" + ); + + const GLfloat plane[] = { + -1, -1, + 1, 1, + -1, 1, + -1, -1, + 1, -1, + 1, 1, + }; + + glGenVertexArrays(1, &_dilation.vao); + glGenBuffers(1, &_dilation.vbo); + + glBindVertexArray(_dilation.vao); + glBindBuffer(GL_ARRAY_BUFFER, _dilation.vbo); + glBufferData(GL_ARRAY_BUFFER, sizeof(plane), plane, GL_STATIC_DRAW); + glEnableVertexAttribArray(0); + glVertexAttribPointer( + 0, + 2, + GL_FLOAT, + GL_FALSE, + sizeof(GLfloat) * 2, + reinterpret_cast(0) + ); + + glBindVertexArray(0); + } + return a && b; } @@ -106,6 +145,15 @@ bool ProjectionComponent::deinitialize() { glDeleteFramebuffers(1, &_fboID); + if (_needsTextureMapDilation) { + glDeleteFramebuffers(1, &_dilation.fbo); + glDeleteVertexArrays(1, &_dilation.vao); + glDeleteBuffers(1, &_dilation.vbo); + + _dilation.program = nullptr; + _dilation.texture = nullptr; + } + return true; } @@ -143,6 +191,11 @@ bool ProjectionComponent::initializeProjectionSettings(const Dictionary& diction _potentialTargets[i] = target; } } + + if (dictionary.hasKeyAndValue(keyNeedsTextureMapDilation)) { + _needsTextureMapDilation = dictionary.value(keyNeedsTextureMapDilation); + } + return completeSuccess; } @@ -214,6 +267,13 @@ bool ProjectionComponent::initializeParser(const ghoul::Dictionary& dictionary) } void ProjectionComponent::imageProjectBegin() { + if (_needsTextureMapDilation) { + if (_dilation.program->isDirty()) { + _dilation.program->rebuildFromFile(); + } + } + + // keep handle to the current bound FBO glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO); @@ -228,6 +288,26 @@ void ProjectionComponent::imageProjectBegin() { } void ProjectionComponent::imageProjectEnd() { + if (_needsTextureMapDilation) { + glBindFramebuffer(GL_FRAMEBUFFER, _dilation.fbo); + + glDisable(GL_BLEND); + + ghoul::opengl::TextureUnit unit; + unit.activate(); + _projectionTexture->bind(); + + _dilation.program->activate(); + _dilation.program->setUniform("tex", unit); + + glBindVertexArray(_dilation.vao); + glDrawArrays(GL_TRIANGLES, 0, 6); + + _dilation.program->deactivate(); + + glEnable(GL_BLEND); + } + glBindFramebuffer(GL_FRAMEBUFFER, _defaultFBO); glViewport(_viewport[0], _viewport[1], _viewport[2], _viewport[3]); } @@ -250,8 +330,31 @@ bool ProjectionComponent::auxiliaryRendertarget() { ); // check FBO status GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - if (status != GL_FRAMEBUFFER_COMPLETE) + if (status != GL_FRAMEBUFFER_COMPLETE) { + LERROR("Main Framebuffer incomplete"); completeSuccess &= false; + } + + + if (_needsTextureMapDilation) { + glGenFramebuffers(1, &_dilation.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, _dilation.fbo); + glFramebufferTexture2D( + GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, + *_dilation.texture, + 0 + ); + + // check FBO status + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + LERROR("Dilation Framebuffer incomplete"); + completeSuccess &= false; + } + } + // switch back to window-system-provided framebuffer glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO); @@ -301,7 +404,12 @@ float ProjectionComponent::projectionFading() const { } ghoul::opengl::Texture& ProjectionComponent::projectionTexture() const { - return *_projectionTexture; + if (_needsTextureMapDilation) { + return *_dilation.texture; + } + else { + return *_projectionTexture; + } } std::string ProjectionComponent::projectorId() const { @@ -344,14 +452,18 @@ void ProjectionComponent::clearAllProjections() { GLint m_viewport[4]; glGetIntegerv(GL_VIEWPORT, m_viewport); //counter = 0; - glBindFramebuffer(GL_FRAMEBUFFER, _fboID); - glViewport(0, 0, static_cast(_projectionTexture->width()), static_cast(_projectionTexture->height())); + glBindFramebuffer(GL_FRAMEBUFFER, _fboID); + glClearColor(0.f, 0.f, 0.f, 0.f); glClear(GL_COLOR_BUFFER_BIT); - //bind back to default + if (_needsTextureMapDilation) { + glBindFramebuffer(GL_FRAMEBUFFER, _dilation.fbo); + glClear(GL_COLOR_BUFFER_BIT); + } + glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO); glViewport(m_viewport[0], m_viewport[1], m_viewport[2], m_viewport[3]); @@ -368,8 +480,9 @@ std::shared_ptr ProjectionComponent::loadProjectionTextu using ghoul::io::TextureReader; - if (isPlaceholder) + if (isPlaceholder) { return _placeholderTexture; + } unique_ptr texture = TextureReader::ref().loadTexture(absPath(texturePath)); @@ -395,9 +508,24 @@ bool ProjectionComponent::generateProjectionLayerTexture() { glm::uvec3(maxSize, maxSize / 2, 1), ghoul::opengl::Texture::Format::RGBA ); - if (_projectionTexture) + if (_projectionTexture) { _projectionTexture->uploadTexture(); + //_projectionTexture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); + } + if (_needsTextureMapDilation) { + _dilation.texture = std::make_unique( + glm::uvec3(maxSize, maxSize / 2, 1), + ghoul::opengl::Texture::Format::RGBA + ); + + if (_dilation.texture) { + _dilation.texture->uploadTexture(); + //_dilation.texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); + } + } + + return _projectionTexture != nullptr; } diff --git a/modules/newhorizons/util/projectioncomponent.h b/modules/newhorizons/util/projectioncomponent.h index 197a886dc4..563494d692 100644 --- a/modules/newhorizons/util/projectioncomponent.h +++ b/modules/newhorizons/util/projectioncomponent.h @@ -32,6 +32,14 @@ #include #include +namespace ghoul { +namespace opengl { + +class ProgramObject; + +} // namespace opengl +} // namespace ghoul + namespace openspace { class ProjectionComponent : public properties::PropertyOwner { @@ -108,6 +116,15 @@ protected: GLint _defaultFBO; GLint _viewport[4]; + + bool _needsTextureMapDilation; + struct { + GLuint fbo; + GLuint vao; + GLuint vbo; + std::unique_ptr program; + std::unique_ptr texture; + } _dilation; }; } // namespace openspace From 92d61851d896b6a3bd62df4c7eea329525886629 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 17 Aug 2016 11:25:47 +0200 Subject: [PATCH 02/12] Enable the setting of the Texture value of the renderabledebugplane in a mod file --- modules/debugging/rendering/renderabledebugplane.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/debugging/rendering/renderabledebugplane.cpp b/modules/debugging/rendering/renderabledebugplane.cpp index 544dc26c72..e3cbf67c47 100644 --- a/modules/debugging/rendering/renderabledebugplane.cpp +++ b/modules/debugging/rendering/renderabledebugplane.cpp @@ -65,6 +65,12 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary) dictionary.getValue("Name", _nodeName); } + if (dictionary.hasKey("Texture")) { + int t; + dictionary.getValue("Texture", t); + _texture = t; + } + std::string origin; if (dictionary.getValue("Origin", origin)) { if (origin == "LowerLeft") { From 1900abc70f4fb31fd24fe7d2ac9f6096b0cb8f5e Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 17 Aug 2016 11:25:58 +0200 Subject: [PATCH 03/12] Enable Edit and Continue feature --- support/cmake/support_macros.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/support/cmake/support_macros.cmake b/support/cmake/support_macros.cmake index a19e11399f..f53cca192c 100644 --- a/support/cmake/support_macros.cmake +++ b/support/cmake/support_macros.cmake @@ -68,7 +68,12 @@ function (set_compile_settings project) set_property(TARGET ${project} PROPERTY CXX_STANDARD_REQUIRED On) if (MSVC) - target_compile_options(${project} PUBLIC "/MP" "/wd4201" "/wd4127") + target_compile_options(${project} PUBLIC + "/MP" # Multi-threading support + "/ZI" # Edit and continue support + "/wd4201" # Disable "nameless struct" warning + "/wd4127" # Disable "conditional expression is constant" warning + ) if (OPENSPACE_WARNINGS_AS_ERRORS) target_compile_options(${project} PUBLIC "/WX") endif () From c4c93964419be56a85f909d5ff58154b026156f3 Mon Sep 17 00:00:00 2001 From: Emil Axelsson Date: Thu, 18 Aug 2016 11:12:28 +0200 Subject: [PATCH 04/12] add rosetta image of the day crawler --- .../crawl_rosetta_images.js | 146 ++++++++++++++++++ .../scripts/crawl_rosetta_images/package.json | 14 ++ 2 files changed, 160 insertions(+) create mode 100644 modules/newhorizons/scripts/crawl_rosetta_images/crawl_rosetta_images.js create mode 100644 modules/newhorizons/scripts/crawl_rosetta_images/package.json diff --git a/modules/newhorizons/scripts/crawl_rosetta_images/crawl_rosetta_images.js b/modules/newhorizons/scripts/crawl_rosetta_images/crawl_rosetta_images.js new file mode 100644 index 0000000000..0176f14bfe --- /dev/null +++ b/modules/newhorizons/scripts/crawl_rosetta_images/crawl_rosetta_images.js @@ -0,0 +1,146 @@ +'use strict'; + +let https = require('https'); +var $ = require('cheerio'); +let fs = require('fs'); + +let archiveUrl = 'https://planetgate.mps.mpg.de/Image_of_the_Day/public/IofD_archive.html'; +let rootUrl = 'https://planetgate.mps.mpg.de/Image_of_the_Day/public/'; + +let missionName = '"ROSETTA"'; +let targetName = '"67P"'; +let instrumentHostName = '"ROSETTA-ORBITER"'; +let instrumentId = '"NAVCAM"'; +let detectorType = '"CAMERA"'; +let downloadFolder = "rosettaimages"; + +function getHttps(url, cb) { + https.get(url, (res) => { + let body = ''; + res.on('data', (d) => { + body += d; + }); + res.on('end', () => { + cb(body); + }); + }); +} + +function padZeros(str, nZeros) { + str = '' + str; + while (str.length < nZeros) str = '0' + str; + return str; +} + +function formatDate(date) { + return date.getFullYear() + '-' + + padZeros(date.getMonth(), 2) + '-' + + padZeros(date.getDate(), 2) + 'T' + + padZeros(date.getHours(), 2) + ':' + + padZeros(date.getMinutes(), 2) + ':' + + padZeros(date.getSeconds(), 2) + '.' + + padZeros(date.getMilliseconds(), 3); +} + +function parseDate(str) { + let year = str.substr(0, 4); + let month = str.substr(5, 2); + let day = str.substr(8, 2); + let hours = str.substr(11, 2); + let minutes = str.substr(14, 2); + let seconds = str.substr(17, 2); + let milliseconds = str.substr(20, 3); + + return new Date(year, month, day, hours, minutes, seconds, milliseconds); +} + +function formatLbl(data) { + let maxKeyLength = 0; + Object.keys(data).forEach((key) => { + maxKeyLength = Math.max(maxKeyLength, key.length); + }); + let outString = ''; + Object.keys(data).forEach((key) => { + let value = data[key]; + outString += key; + outString += (new Array(maxKeyLength - key.length + 1)).join(' '); + outString += ' = '; + outString += value; + outString += '\n'; + }); + outString += 'END'; + return outString; +} + +getHttps(archiveUrl, (body) => { + let $root = $.load(body); + + $root('tr td').map((i, td) => { + let thumbnailName = $(td).find('img').attr('src'); + let imageUrl = ''; + if (thumbnailName) { + let originalName = thumbnailName.replace('_tn', ''); + imageUrl = rootUrl + originalName; + } + + + let detailsName = $(td).find('a').attr('href'); + if (detailsName) { + let detailsUrl = rootUrl + detailsName; + + getHttps(detailsUrl, (detailsBody) => { + let $detailsRoot = $.load(detailsBody); + + let startTime = ''; + let id = ''; + let cam = ''; + let exposureTime = ''; + + $detailsRoot('tr').map((i, detailsTr) => { + let header = $(detailsTr).children('th').html(); + let cell = $(detailsTr).children('td').html(); + + switch (header) { + case 'ID': id = cell; break; + case 'Date taken': startTime = cell; break; + case 'Camera': cam = cell; break; + case 'Exposure time': exposureTime = cell; break; + } + }); + + let exposureSeconds = 0; + if (exposureTime.substr(-2) === ' s') { + exposureSeconds = +exposureTime.substr(0, exposureTime.length - 2); + } else { + throw "exposure time expressed in unexpeded format, " + exposureTime; + } + + let startDate = parseDate(startTime); + let stopDate = new Date(startDate.getTime() + exposureSeconds * 1000); + + let lblContents = formatLbl({ + MISSION_NAME: missionName, + TARGET_NAME: targetName, + INSTRUMENT_HOST_NAME: instrumentHostName, + INSTRUMENT_ID: instrumentId, + DETECTOR_TYPE: detectorType, + START_TIME: formatDate(startDate), + STOP_TIME: formatDate(stopDate) + }); + + let filenameWithoutSuffix = downloadFolder + '/' + id; + fs.writeFile(filenameWithoutSuffix + '.lbl', lblContents, (err) => { + if (err) { + throw err; + } + }); + + let suffix = imageUrl.substr(imageUrl.lastIndexOf('.')); + let file = fs.createWriteStream(filenameWithoutSuffix + suffix); + let request = https.get(imageUrl, (res) => { + res.pipe(file); + }); + }); + } + }); +}); diff --git a/modules/newhorizons/scripts/crawl_rosetta_images/package.json b/modules/newhorizons/scripts/crawl_rosetta_images/package.json new file mode 100644 index 0000000000..8552f6e0c6 --- /dev/null +++ b/modules/newhorizons/scripts/crawl_rosetta_images/package.json @@ -0,0 +1,14 @@ +{ + "name": "67p-crawler", + "version": "1.0.0", + "description": "", + "main": "crawler.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "MIT", + "dependencies": { + "cheerio": "^0.20.0" + } +} From e2845434342f7eda02db612b156eb1709f0b0ed2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 18 Aug 2016 11:43:51 +0200 Subject: [PATCH 05/12] Make use of a secondary stencil buffer for masking the dilation areas --- .../rendering/renderableplanetprojection.cpp | 3 +- modules/newhorizons/shaders/dilation_fs.glsl | 7 ++- .../shaders/renderableModelProjection_fs.glsl | 33 +++++++------ .../shaders/renderableModel_fs.glsl | 4 +- .../renderablePlanetProjection_fs.glsl | 6 ++- .../newhorizons/util/projectioncomponent.cpp | 49 ++++++++++++++++--- .../newhorizons/util/projectioncomponent.h | 1 + 7 files changed, 75 insertions(+), 28 deletions(-) diff --git a/modules/newhorizons/rendering/renderableplanetprojection.cpp b/modules/newhorizons/rendering/renderableplanetprojection.cpp index 13516f1e5f..51523d6d9b 100644 --- a/modules/newhorizons/rendering/renderableplanetprojection.cpp +++ b/modules/newhorizons/rendering/renderableplanetprojection.cpp @@ -364,8 +364,9 @@ void RenderablePlanetProjection::update(const UpdateData& data) { _fboProgramObject->rebuildFromFile(); } - if (_programObject->isDirty()) + if (_programObject->isDirty()) { _programObject->rebuildFromFile(); + } _time = Time::ref().currentTime(); _capture = false; diff --git a/modules/newhorizons/shaders/dilation_fs.glsl b/modules/newhorizons/shaders/dilation_fs.glsl index e9080e13b4..65ce29c64e 100644 --- a/modules/newhorizons/shaders/dilation_fs.glsl +++ b/modules/newhorizons/shaders/dilation_fs.glsl @@ -28,6 +28,7 @@ in vec2 vs_uv; out vec4 color; uniform sampler2D tex; +uniform sampler2D stencil; vec2 offsets[8] = { vec2(-1.0, -1.0), @@ -50,8 +51,9 @@ vec3 gatherColors(vec2 position) { vec4 colors[8]; for (int i = 0; i < 8; i++) { colors[i] = texture(tex, position + h * offsets[i]); + float s = texture(stencil, position + h * offsets[i]).r; - if (colors[i].a != 0.0) { + if (s != 0.0) { totalColor.rgb += colors[i].rgb; nContributions++; } @@ -62,8 +64,9 @@ vec3 gatherColors(vec2 position) { void main() { vec4 c = texture(tex, vs_uv); + float s = texture(stencil, vs_uv).r; - if (c.a == 0.0) { + if (s == 0.0) { // This means that the current fragment/texel we are looking at has not been // projected on and we only want to do the dilation into these texels diff --git a/modules/newhorizons/shaders/renderableModelProjection_fs.glsl b/modules/newhorizons/shaders/renderableModelProjection_fs.glsl index 0d0bcbec89..34d683f98b 100644 --- a/modules/newhorizons/shaders/renderableModelProjection_fs.glsl +++ b/modules/newhorizons/shaders/renderableModelProjection_fs.glsl @@ -31,7 +31,8 @@ in vec4 vs_normal; in vec2 vs_uv; in vec4 ProjTexCoord; -out vec4 color; +layout (location = 0) out vec4 color; +layout (location = 1) out float stencil; uniform sampler2D projectionTexture; @@ -44,22 +45,24 @@ bool inRange(float x, float a, float b) { } void main() { - vec2 uv = vec2(0.5,0.5)*vs_uv+vec2(0.5,0.5); + vec2 uv = vec2(0.5,0.5)*vs_uv+vec2(0.5,0.5); - vec3 n = normalize(vs_normal.xyz); - vec4 projected = ProjTexCoord; + vec3 n = normalize(vs_normal.xyz); + vec4 projected = ProjTexCoord; - //normalize - projected.x /= projected.w; - projected.y /= projected.w; - //invert gl coordinates - projected.x = 1 - projected.x; - - if ((inRange(projected.x, 0, 1) && inRange(projected.y, 0, 1)) && (dot(n, boresight) < 0)) { + // normalize + projected.x /= projected.w; + projected.y /= projected.w; + // invert gl coordinates + projected.x = 1 - projected.x; + + if ((inRange(projected.x, 0, 1) && inRange(projected.y, 0, 1)) && (dot(n, boresight) < 0)) { color = texture(projectionTexture, projected.xy); color.a = 1.0; - } - else { - color = vec4(vec3(0.0), 1.0); - } + stencil = 1.0; + } + else { + color = vec4(vec3(0.0), 1.0); + stencil = 0.0; + } } diff --git a/modules/newhorizons/shaders/renderableModel_fs.glsl b/modules/newhorizons/shaders/renderableModel_fs.glsl index d90d70e350..a5a431042b 100644 --- a/modules/newhorizons/shaders/renderableModel_fs.glsl +++ b/modules/newhorizons/shaders/renderableModel_fs.glsl @@ -70,13 +70,13 @@ Fragment getFragment() { vec4 textureColor = texture(baseTexture, vs_st); vec4 projectionColor = texture(projectionTexture, vs_st); - // if (projectionColor.a != 0.0) { + if (projectionColor.a != 0.0) { textureColor.rgb = mix( textureColor.rgb, projectionColor.rgb, _projectionFading ); - // } + } Fragment frag; frag.color = max(intensity * textureColor, ambient); diff --git a/modules/newhorizons/shaders/renderablePlanetProjection_fs.glsl b/modules/newhorizons/shaders/renderablePlanetProjection_fs.glsl index 3f6e2be3ba..7213c6c22f 100644 --- a/modules/newhorizons/shaders/renderablePlanetProjection_fs.glsl +++ b/modules/newhorizons/shaders/renderablePlanetProjection_fs.glsl @@ -27,7 +27,9 @@ #include "PowerScaling/powerScaling_vs.hglsl" in vec4 vs_position; -out vec4 color; + +layout (location = 0) out vec4 color; +layout (location = 1) out vec4 stencil; uniform sampler2D projectionTexture; @@ -82,8 +84,10 @@ void main() { // The 1-x is in this texture call because of flipped textures // to be fixed soon ---abock color = texture(projectionTexture, vec2(projected.x, 1-projected.y)); + stencil = vec4(1.0); } else { color = vec4(0.0); + stencil = vec4(0.0); } } \ No newline at end of file diff --git a/modules/newhorizons/util/projectioncomponent.cpp b/modules/newhorizons/util/projectioncomponent.cpp index 7b78bb8f05..7d99849c7c 100644 --- a/modules/newhorizons/util/projectioncomponent.cpp +++ b/modules/newhorizons/util/projectioncomponent.cpp @@ -186,9 +186,9 @@ bool ProjectionComponent::initializeProjectionSettings(const Dictionary& diction _potentialTargets.resize(potentialTargets.size()); for (int i = 0; i < potentialTargets.size(); ++i) { - std::string target; - potentialTargets.getValue(std::to_string(i + 1), target); - _potentialTargets[i] = target; +std::string target; +potentialTargets.getValue(std::to_string(i + 1), target); +_potentialTargets[i] = target; } } @@ -285,6 +285,11 @@ void ProjectionComponent::imageProjectBegin() { static_cast(_projectionTexture->width()), static_cast(_projectionTexture->height()) ); + + if (_needsTextureMapDilation) { + GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }; + glDrawBuffers(2, buffers); + } } void ProjectionComponent::imageProjectEnd() { @@ -293,12 +298,16 @@ void ProjectionComponent::imageProjectEnd() { glDisable(GL_BLEND); - ghoul::opengl::TextureUnit unit; - unit.activate(); + ghoul::opengl::TextureUnit unit[2]; + unit[0].activate(); _projectionTexture->bind(); + unit[1].activate(); + _dilation.stencilTexture->bind(); + _dilation.program->activate(); - _dilation.program->setUniform("tex", unit); + _dilation.program->setUniform("tex", unit[0]); + _dilation.program->setUniform("stencil", unit[1]); glBindVertexArray(_dilation.vao); glDrawArrays(GL_TRIANGLES, 0, 6); @@ -337,6 +346,22 @@ bool ProjectionComponent::auxiliaryRendertarget() { if (_needsTextureMapDilation) { + // We only need the stencil texture if we need to dilate + glFramebufferTexture2D( + GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT1, + GL_TEXTURE_2D, + *_dilation.stencilTexture, + 0 + ); + + // check FBO status + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + LERROR("Main Framebuffer incomplete"); + completeSuccess &= false; + } + glGenFramebuffers(1, &_dilation.fbo); glBindFramebuffer(GL_FRAMEBUFFER, _dilation.fbo); glFramebufferTexture2D( @@ -348,7 +373,7 @@ bool ProjectionComponent::auxiliaryRendertarget() { ); // check FBO status - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { LERROR("Dilation Framebuffer incomplete"); completeSuccess &= false; @@ -523,6 +548,16 @@ bool ProjectionComponent::generateProjectionLayerTexture() { _dilation.texture->uploadTexture(); //_dilation.texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); } + + _dilation.stencilTexture = std::make_unique( + glm::uvec3(maxSize, maxSize / 2, 1), + ghoul::opengl::Texture::Format::RGBA + ); + + if (_dilation.stencilTexture) { + _dilation.stencilTexture->uploadTexture(); + //_dilation.texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); + } } diff --git a/modules/newhorizons/util/projectioncomponent.h b/modules/newhorizons/util/projectioncomponent.h index 563494d692..13731d9c24 100644 --- a/modules/newhorizons/util/projectioncomponent.h +++ b/modules/newhorizons/util/projectioncomponent.h @@ -124,6 +124,7 @@ protected: GLuint vbo; std::unique_ptr program; std::unique_ptr texture; + std::unique_ptr stencilTexture; } _dilation; }; From e5db594c3b9687f42458e4463ae6cc4d7d3b3038 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 18 Aug 2016 13:55:00 +0200 Subject: [PATCH 06/12] Add torrent for new missing Rosetta kernels --- .../rosetta/rosetta/RosettaKernels_New.torrent | Bin 0 -> 12539 bytes data/scene/rosetta/rosetta/rosetta.data | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 data/scene/rosetta/rosetta/RosettaKernels_New.torrent diff --git a/data/scene/rosetta/rosetta/RosettaKernels_New.torrent b/data/scene/rosetta/rosetta/RosettaKernels_New.torrent new file mode 100644 index 0000000000000000000000000000000000000000..cdb32f8b5dd8dfc9181f2175e5ccf6ed6c52c4a2 GIT binary patch literal 12539 zcmb8WWmucrqP2~?yG!w6Nk{?&hvM$;1d6*$p?Gm9THM{OxVKQ;Da9$pDNvwA->$XK zUT3d$-t%4W_x#C~WR7`{Ip%ogziA}^Gk0=w_H?p@gTXLQD;F3quZNqtr9Iq@$Jqt$ zWMS*!;q2xHckVlH0-7-NV7*|K|j72QcXWLj05d8}4QU1M>0l z|HXsDfdH7L8{FIjZpC2X3;gX?>tD`z`FOxQ0>AzI`LC_B6NA<7LAF3JKM(=}0tNWt z0x-CfrL&c-lMMu>ttG=P0EXE*Svy-nVAi${aCZkQD9i!wWaIJD76btC!ND*WbB~t} zAef9I2msSi)ijlo)7H?}R#w$9)d2u`v}EA$|C9*)CEd5QNn1-=OJ2fMLsM1iH-_(j=pg)nzw7?Xo2=&ls)6zW zp?}i=1^#4dYDvqhX#S=^{z(CXpn$)Y1A@sb0{Q<`s7UBYNhtqo`SSm{93T`ZDEMy% z7^W$uqzDxJQv!qnz#xd}ZB|7P&P zG}RRO05B<44J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g)9umjsjZ*Xbej3DKfG{Od78%@c#2m3fgG0h8#@E>|s`nLvLXBrnh&d?)o&t^V*#vrY22J)|TFK(>q z`GpAyNk5^+0gzlJEnj0Y50WpdhC6*eY9cn49|dw9lua0na5*b1xgnM%DqL0 zO`h=8_>Ep1pIr*!nvkNOGnRDdr1UGckjdGLIqv&Y1pfutpaY`aXiz*M8h1D2bT2!& z+zjdP=~n&r+@Achu5g|kt;c3{Ku>_(NkwGDVOXV71Z@atwA9pOsvR4uj!lFh3pLOs|i}3Fn-yBM2no zU#`D5xP>c~vvcOwQn!M> z&~xd0{ZiTQ=dXjtNXKBWFdr&X%;TG<;9&kP&?4^gtAGaC2y}kdu$>8o{ SZV7jBbGCz9{&|-H{(k_RlhP0X literal 0 HcmV?d00001 diff --git a/data/scene/rosetta/rosetta/rosetta.data b/data/scene/rosetta/rosetta/rosetta.data index 1554d25842..98c46c37a2 100644 --- a/data/scene/rosetta/rosetta/rosetta.data +++ b/data/scene/rosetta/rosetta/rosetta.data @@ -4,6 +4,7 @@ return { { Identifier = "rosetta_textures", Destination = "textures", Version = 1 } }, TorrentFiles = { - { File = "RosettaKernels.torrent", Destination = "${SPICE}" } + { File = "RosettaKernels.torrent", Destination = "${SPICE}" }, + { File = "RosettaKernels_New.torrent", Destination = "${SPICE}" } } } \ No newline at end of file From 010b8739f1e2c97726e10f83665c776eb35e3a98 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 18 Aug 2016 15:45:07 +0200 Subject: [PATCH 07/12] Use the correct output in the renderablemodelprojection shader --- modules/newhorizons/shaders/dilation_fs.glsl | 12 +++++------- .../shaders/renderableModelProjection_fs.glsl | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/newhorizons/shaders/dilation_fs.glsl b/modules/newhorizons/shaders/dilation_fs.glsl index 65ce29c64e..9328e7c2ce 100644 --- a/modules/newhorizons/shaders/dilation_fs.glsl +++ b/modules/newhorizons/shaders/dilation_fs.glsl @@ -43,18 +43,16 @@ vec2 offsets[8] = { vec3 gatherColors(vec2 position) { vec2 texSize = textureSize(tex, 0); - vec2 h = vec2(1.0) / texSize; int nContributions = 0; vec3 totalColor = vec3(0.0); - vec4 colors[8]; for (int i = 0; i < 8; i++) { - colors[i] = texture(tex, position + h * offsets[i]); - float s = texture(stencil, position + h * offsets[i]).r; + vec2 samplePosition = (gl_FragCoord.xy + offsets[i]) / texSize; - if (s != 0.0) { - totalColor.rgb += colors[i].rgb; + if (texture(stencil, samplePosition).r != 0.0) { + vec3 c = texture(tex, samplePosition).rgb; + totalColor += c; nContributions++; } } @@ -70,7 +68,7 @@ void main() { // This means that the current fragment/texel we are looking at has not been // projected on and we only want to do the dilation into these texels - color = vec4(gatherColors(vs_uv), 0.0); + color = vec4(gatherColors(vs_uv), 1.0); } else { // We are in a region where an image has been projected, so we can reuse the diff --git a/modules/newhorizons/shaders/renderableModelProjection_fs.glsl b/modules/newhorizons/shaders/renderableModelProjection_fs.glsl index 34d683f98b..6a0219d937 100644 --- a/modules/newhorizons/shaders/renderableModelProjection_fs.glsl +++ b/modules/newhorizons/shaders/renderableModelProjection_fs.glsl @@ -32,7 +32,7 @@ in vec2 vs_uv; in vec4 ProjTexCoord; layout (location = 0) out vec4 color; -layout (location = 1) out float stencil; +layout (location = 1) out vec4 stencil; uniform sampler2D projectionTexture; @@ -59,10 +59,10 @@ void main() { if ((inRange(projected.x, 0, 1) && inRange(projected.y, 0, 1)) && (dot(n, boresight) < 0)) { color = texture(projectionTexture, projected.xy); color.a = 1.0; - stencil = 1.0; + stencil = vec4(1.0); } else { color = vec4(vec3(0.0), 1.0); - stencil = 0.0; + stencil = vec4(0.0); } } From 72e1e9231a06f32843aae8eb5b78cd8c0f8dd743 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 18 Aug 2016 16:27:44 +0200 Subject: [PATCH 08/12] Add an update method to the ProjectionComponent that takes care of Shader rebuildin --- data/scene/rosetta.scene | 2 + .../rendering/renderablemodelprojection.cpp | 8 +++- .../rendering/renderablemodelprojection.h | 2 +- .../rendering/renderableplanetprojection.cpp | 2 + .../newhorizons/util/projectioncomponent.cpp | 47 +++++++++++-------- .../newhorizons/util/projectioncomponent.h | 2 + 6 files changed, 40 insertions(+), 23 deletions(-) diff --git a/data/scene/rosetta.scene b/data/scene/rosetta.scene index 39dc7b087b..54c810af07 100644 --- a/data/scene/rosetta.scene +++ b/data/scene/rosetta.scene @@ -31,6 +31,8 @@ function postInitialization() openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55) openspace.setPropertyValue("MilkyWay.renderable.segments", 50) + openspace.setPropertyValue('67P.renderable.performShading', false); + openspace.printInfo("Done setting default values") end diff --git a/modules/newhorizons/rendering/renderablemodelprojection.cpp b/modules/newhorizons/rendering/renderablemodelprojection.cpp index 477e2b62ca..aff65ca58b 100644 --- a/modules/newhorizons/rendering/renderablemodelprojection.cpp +++ b/modules/newhorizons/rendering/renderablemodelprojection.cpp @@ -199,11 +199,15 @@ void RenderableModelProjection::render(const RenderData& data) { } void RenderableModelProjection::update(const UpdateData& data) { - if (_programObject->isDirty()) + if (_programObject->isDirty()) { _programObject->rebuildFromFile(); + } - if (_fboProgramObject->isDirty()) + if (_fboProgramObject->isDirty()) { _fboProgramObject->rebuildFromFile(); + } + + _projectionComponent.update(); _time = data.time; diff --git a/modules/newhorizons/rendering/renderablemodelprojection.h b/modules/newhorizons/rendering/renderablemodelprojection.h index 644af7b905..9f9d0227ab 100644 --- a/modules/newhorizons/rendering/renderablemodelprojection.h +++ b/modules/newhorizons/rendering/renderablemodelprojection.h @@ -55,7 +55,7 @@ public: bool isReady() const override; void render(const RenderData& data) override; - void update(const UpdateData& data) override; + virtual void update(const UpdateData& data) final override; ghoul::opengl::Texture& baseTexture() const; diff --git a/modules/newhorizons/rendering/renderableplanetprojection.cpp b/modules/newhorizons/rendering/renderableplanetprojection.cpp index 51523d6d9b..35aac4f50d 100644 --- a/modules/newhorizons/rendering/renderableplanetprojection.cpp +++ b/modules/newhorizons/rendering/renderableplanetprojection.cpp @@ -368,6 +368,8 @@ void RenderablePlanetProjection::update(const UpdateData& data) { _programObject->rebuildFromFile(); } + _projectionComponent.update(); + _time = Time::ref().currentTime(); _capture = false; diff --git a/modules/newhorizons/util/projectioncomponent.cpp b/modules/newhorizons/util/projectioncomponent.cpp index 7d99849c7c..ecdc65fbd8 100644 --- a/modules/newhorizons/util/projectioncomponent.cpp +++ b/modules/newhorizons/util/projectioncomponent.cpp @@ -186,9 +186,9 @@ bool ProjectionComponent::initializeProjectionSettings(const Dictionary& diction _potentialTargets.resize(potentialTargets.size()); for (int i = 0; i < potentialTargets.size(); ++i) { -std::string target; -potentialTargets.getValue(std::to_string(i + 1), target); -_potentialTargets[i] = target; + std::string target; + potentialTargets.getValue(std::to_string(i + 1), target); + _potentialTargets[i] = target; } } @@ -267,13 +267,6 @@ bool ProjectionComponent::initializeParser(const ghoul::Dictionary& dictionary) } void ProjectionComponent::imageProjectBegin() { - if (_needsTextureMapDilation) { - if (_dilation.program->isDirty()) { - _dilation.program->rebuildFromFile(); - } - } - - // keep handle to the current bound FBO glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO); @@ -321,6 +314,14 @@ void ProjectionComponent::imageProjectEnd() { glViewport(_viewport[0], _viewport[1], _viewport[2], _viewport[3]); } +void ProjectionComponent::update() { + if (_needsTextureMapDilation) { + if (_dilation.program->isDirty()) { + _dilation.program->rebuildFromFile(); + } + } +} + bool ProjectionComponent::auxiliaryRendertarget() { bool completeSuccess = true; @@ -402,18 +403,24 @@ glm::mat4 ProjectionComponent::computeProjectorMatrix(const glm::vec3 loc, glm:: glm::vec3 e3 = glm::normalize(boreSight); glm::vec3 e1 = glm::normalize(glm::cross(uptmp, e3)); glm::vec3 e2 = glm::normalize(glm::cross(e3, e1)); - glm::mat4 projViewMatrix = glm::mat4(e1.x, e2.x, e3.x, 0.f, - e1.y, e2.y, e3.y, 0.f, - e1.z, e2.z, e3.z, 0.f, - -glm::dot(e1, loc), -glm::dot(e2, loc), -glm::dot(e3, loc), 1.f); + glm::mat4 projViewMatrix = glm::mat4( + e1.x, e2.x, e3.x, 0.f, + e1.y, e2.y, e3.y, 0.f, + e1.z, e2.z, e3.z, 0.f, + -glm::dot(e1, loc), -glm::dot(e2, loc), -glm::dot(e3, loc), 1.f + ); // create perspective projection matrix - glm::mat4 projProjectionMatrix = glm::perspective(glm::radians(fieldOfViewY), aspectRatio, nearPlane, farPlane); + glm::mat4 projProjectionMatrix = glm::perspective( + glm::radians(fieldOfViewY), aspectRatio, nearPlane, farPlane + ); // bias matrix - glm::mat4 projNormalizationMatrix = glm::mat4(0.5f, 0, 0, 0, - 0, 0.5f, 0, 0, - 0, 0, 0.5f, 0, - 0.5f, 0.5f, 0.5f, 1); - return projNormalizationMatrix*projProjectionMatrix*projViewMatrix; + glm::mat4 projNormalizationMatrix = glm::mat4( + 0.5f, 0.f, 0.f, 0.f, + 0.f, 0.5f, 0.f, 0.f, + 0.f, 0.f, 0.5f, 0.f, + 0.5f, 0.5f, 0.5f, 1.f + ); + return projNormalizationMatrix * projProjectionMatrix * projViewMatrix; } bool ProjectionComponent::doesPerformProjection() const { diff --git a/modules/newhorizons/util/projectioncomponent.h b/modules/newhorizons/util/projectioncomponent.h index 13731d9c24..3386b63a1d 100644 --- a/modules/newhorizons/util/projectioncomponent.h +++ b/modules/newhorizons/util/projectioncomponent.h @@ -57,6 +57,8 @@ public: void imageProjectBegin(); void imageProjectEnd(); + void update(); + bool generateProjectionLayerTexture(); bool auxiliaryRendertarget(); From 2ae7095d9ba3393816d877dde5271058cfa436c2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 18 Aug 2016 16:29:00 +0200 Subject: [PATCH 09/12] Fix image dilation (closing #108) - Using pixel(=texel) coordinates and integer offsets - Using a single channel stencil texture instead of a 4-channel one --- modules/newhorizons/shaders/dilation_fs.glsl | 40 +++++++++++++------ .../shaders/renderableModelProjection_fs.glsl | 6 +-- .../newhorizons/util/projectioncomponent.cpp | 3 +- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/modules/newhorizons/shaders/dilation_fs.glsl b/modules/newhorizons/shaders/dilation_fs.glsl index 9328e7c2ce..d5a740d681 100644 --- a/modules/newhorizons/shaders/dilation_fs.glsl +++ b/modules/newhorizons/shaders/dilation_fs.glsl @@ -30,6 +30,8 @@ out vec4 color; uniform sampler2D tex; uniform sampler2D stencil; +// We conside the 8-neighborhood of a texel, so going a stepsize of '1' in both +// directions vec2 offsets[8] = { vec2(-1.0, -1.0), vec2(-1.0, 0.0), @@ -41,38 +43,52 @@ vec2 offsets[8] = { vec2(1.0, 1.0) }; -vec3 gatherColors(vec2 position) { +// Collect the contributing colors from the neighboring texels and return the +// averaged value of all texels that passed the masking test based on 'stencil' +vec3 gatherNeighboringColors() { vec2 texSize = textureSize(tex, 0); + // The total number of contributing texels int nContributions = 0; + + // The summed color of all contributing texels vec3 totalColor = vec3(0.0); for (int i = 0; i < 8; i++) { + // gl_FragCoord is in pixel coordinates; the ProjectionComponent sets + // the viewport such that pixels=texels, so we can use gl_FragCoord as an + // integer texel coordinate + // First offsetting them, then dividing by the texture size to get to [0,1] vec2 samplePosition = (gl_FragCoord.xy + offsets[i]) / texSize; + // The stencelling determines the areas that we have to enlarge, such that we + // do not enlarge a previously enlarged area if (texture(stencil, samplePosition).r != 0.0) { - vec3 c = texture(tex, samplePosition).rgb; - totalColor += c; + totalColor += texture(tex, samplePosition).rgb; nContributions++; } } - return totalColor / nContributions; + // GLSL normally doesn't have a problem taking vec3(0.0)/0.0 but we don't want to + // tempt the compiler gods + if (nContributions > 0) { + return totalColor / nContributions; + } + else { + return vec3(0.0); + } + } void main() { - vec4 c = texture(tex, vs_uv); - float s = texture(stencil, vs_uv).r; - - if (s == 0.0) { + if (texture(stencil, vs_uv).r == 0.0) { // This means that the current fragment/texel we are looking at has not been // projected on and we only want to do the dilation into these texels - - color = vec4(gatherColors(vs_uv), 1.0); + color = vec4(gatherNeighboringColors(), 1.0); } else { // We are in a region where an image has been projected, so we can reuse the // already sampled version - color = c; + color = texture(tex, vs_uv); } -} \ No newline at end of file +} diff --git a/modules/newhorizons/shaders/renderableModelProjection_fs.glsl b/modules/newhorizons/shaders/renderableModelProjection_fs.glsl index 6a0219d937..30d4da79dd 100644 --- a/modules/newhorizons/shaders/renderableModelProjection_fs.glsl +++ b/modules/newhorizons/shaders/renderableModelProjection_fs.glsl @@ -24,14 +24,14 @@ #version __CONTEXT__ -#include "PowerScaling/powerScaling_vs.hglsl" - in vec4 vs_position; in vec4 vs_normal; in vec2 vs_uv; in vec4 ProjTexCoord; -layout (location = 0) out vec4 color; +layout (location = 0) out vec4 color; +// Even though the stencel texture is only a single channel, we still need to +// output a vec4, or the result will disappear layout (location = 1) out vec4 stencil; uniform sampler2D projectionTexture; diff --git a/modules/newhorizons/util/projectioncomponent.cpp b/modules/newhorizons/util/projectioncomponent.cpp index ecdc65fbd8..530f6e1aa7 100644 --- a/modules/newhorizons/util/projectioncomponent.cpp +++ b/modules/newhorizons/util/projectioncomponent.cpp @@ -558,7 +558,8 @@ bool ProjectionComponent::generateProjectionLayerTexture() { _dilation.stencilTexture = std::make_unique( glm::uvec3(maxSize, maxSize / 2, 1), - ghoul::opengl::Texture::Format::RGBA + ghoul::opengl::Texture::Format::Red, + ghoul::opengl::Texture::Format::Red ); if (_dilation.stencilTexture) { From 21e959988828aea6f31ae86605f97b09fbc5a5fc Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 18 Aug 2016 17:33:08 +0200 Subject: [PATCH 10/12] SyncWidget in Launcher must also compare base directory before removing duplicates (closing #126) --- apps/Launcher/syncwidget.cpp | 14 +++++--------- apps/Launcher/syncwidget.h | 7 +++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/Launcher/syncwidget.cpp b/apps/Launcher/syncwidget.cpp index 7cdc9e2d96..cd57f204d2 100644 --- a/apps/Launcher/syncwidget.cpp +++ b/apps/Launcher/syncwidget.cpp @@ -369,13 +369,7 @@ void SyncWidget::syncButtonPressed() { LERROR("Could not find 'Modules'"); return; } - - struct ModuleInformation { - QString moduleName; - QString moduleDatafile; - QString modulePath; - }; - + QDir sceneDir(scene); sceneDir.cdUp(); QList modulesList; @@ -527,7 +521,7 @@ void SyncWidget::syncButtonPressed() { //// Make the lists unique { auto equal = [](const DirectFile& lhs, const DirectFile& rhs) -> bool { - return lhs.module == rhs.module && lhs.url == rhs.url && lhs.destination == rhs.destination; + return lhs.module == rhs.module && lhs.url == rhs.url && lhs.destination == rhs.destination && lhs.baseDir == rhs.baseDir; }; QList files; @@ -552,6 +546,7 @@ void SyncWidget::syncButtonPressed() { lhs.module == rhs.module && lhs.identifier == rhs.identifier && lhs.destination == rhs.destination && + lhs.baseDir == rhs.baseDir && lhs.version == rhs.version; }; @@ -576,7 +571,8 @@ void SyncWidget::syncButtonPressed() { return lhs.module == rhs.module && lhs.file == rhs.file && - lhs.destination == rhs.destination; + lhs.destination == rhs.destination && + lhs.baseDir == rhs.baseDir; }; QList files; diff --git a/apps/Launcher/syncwidget.h b/apps/Launcher/syncwidget.h index 98249888e0..6306fea1f3 100644 --- a/apps/Launcher/syncwidget.h +++ b/apps/Launcher/syncwidget.h @@ -83,6 +83,13 @@ private: QString baseDir; }; + + struct ModuleInformation { + QString moduleName; + QString moduleDatafile; + QString modulePath; + }; + void clear(); QStringList selectedScenes() const; From e14387a4fa928384ab1095180846dc14cd391d17 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 19 Aug 2016 08:35:44 +0200 Subject: [PATCH 11/12] Update the data files for Pluto and Charon to download all necessary files --- data/scene/newhorizons/pluto/charon/charon.data | 2 +- data/scene/newhorizons/pluto/pluto/pluto.data | 4 ++-- data/scene/pluto/pluto.data | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/scene/newhorizons/pluto/charon/charon.data b/data/scene/newhorizons/pluto/charon/charon.data index 73ecb53d87..0e0214f515 100644 --- a/data/scene/newhorizons/pluto/charon/charon.data +++ b/data/scene/newhorizons/pluto/charon/charon.data @@ -1,5 +1,5 @@ return { FileRequest = { - { Identifier = "charon_textures", Destination = "textures", Version = 1 } + { Identifier = "charon_textures", Destination = "textures", Version = 2 } }, } \ No newline at end of file diff --git a/data/scene/newhorizons/pluto/pluto/pluto.data b/data/scene/newhorizons/pluto/pluto/pluto.data index fff1025604..13ab280e5a 100644 --- a/data/scene/newhorizons/pluto/pluto/pluto.data +++ b/data/scene/newhorizons/pluto/pluto/pluto.data @@ -1,8 +1,8 @@ return { FileRequest = { { Identifier = "newhorizons_plutoencounter_pluto_assets", Destination = "assets", Version = 1 }, - { Identifier = "newhorizons_plutoencounter_pluto_textures", Destination = "textures", Version = 3 }, - { Identifier = "pluto_textures", Destination = "textures", Version = 2 }, + { Identifier = "newhorizons_plutoencounter_pluto_textures", Destination = "textures", Version = 4 }, + { Identifier = "pluto_textures", Destination = "textures", Version = 4 }, { Identifier = "newhorizons_plutoencounter_pluto_images", Destination = "images", Version = 1 } }, } \ No newline at end of file diff --git a/data/scene/pluto/pluto.data b/data/scene/pluto/pluto.data index bc793cb889..264a9ff830 100644 --- a/data/scene/pluto/pluto.data +++ b/data/scene/pluto/pluto.data @@ -1,6 +1,6 @@ return { FileRequest = { { Identifier = "charon_textures", Destination = "textures", Version = 1 }, - { Identifier = "pluto_textures", Destination = "textures", Version = 2 } + { Identifier = "pluto_textures", Destination = "textures", Version = 4 } } } \ No newline at end of file From adf02bd5f6988d3f07ffefa189b78bffa6ad5553 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 19 Aug 2016 16:42:19 +0200 Subject: [PATCH 12/12] Updated Ghoul - Adapted to CommandlineParser changes --- ext/ghoul | 2 +- src/engine/openspaceengine.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index c660815ff5..e4fb129b95 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c660815ff59b3d1be8f81d6614f84f420b39684b +Subproject commit e4fb129b954e8a0dac8f407a1a1fe7d9c8150007 diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index fb4b319aa3..fd61245869 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -234,8 +234,10 @@ bool OpenSpaceEngine::create(int argc, char** argv, return false; // Parse commandline arguments + std::vector args(argv, argv + argc); std::shared_ptr> arguments = - _engine->_commandlineParser->setCommandLine(argc, argv); + _engine->_commandlineParser->setCommandLine(args); + bool showHelp = _engine->_commandlineParser->execute(); if (showHelp) { _engine->_commandlineParser->displayHelp();