Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 8a8f9bba authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Improved VolumeExplorer:

* Fixed orientation of XY-slice (flipped along Y axis)
* Implemented background for raycasting result
* Fixed sum for volume rendering integral evaluation in simpleraycaster.frag
parent 0e690e22
......@@ -26,6 +26,11 @@ uniform vec4 _backgroundColor1;
uniform vec4 _backgroundColor2;
void renderBackground(in vec2 texCoords, out vec4 outColor) {
outColor = mix(_backgroundColor1, _backgroundColor2, 0.5 * (texCoords.x + texCoords.y));
gl_FragDepth = 1.0;
outColor = mix(_backgroundColor1, _backgroundColor2, 0.5 * (texCoords.x + texCoords.y));
gl_FragDepth = 1.0;
}
vec4 blendBackground(in vec2 texCoords, in vec4 outColor) {
vec4 backgroundColor = mix(_backgroundColor1, _backgroundColor2, 0.5 * (texCoords.x + texCoords.y));
return vec4(mix(backgroundColor.rgb, outColor.rgb, outColor.a), backgroundColor.a);
}
\ No newline at end of file
......@@ -127,7 +127,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
// accomodate for variable sampling rates
color.a = 1.0 - pow(1.0 - color.a, _samplingStepSize * SAMPLING_BASE_INTERVAL_RCP);
result.rgb = mix(color.rgb, result.rgb, result.a);
result.rgb = result.rgb + color.rgb * color.a * (1.0 - result.a);
result.a = result.a + (1.0 -result.a) * color.a;
}
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
in vec3 ex_TexCoord;
out vec4 out_Color;
#include "tools/background.frag"
#include "tools/texture2d.frag"
uniform sampler2D _colorTexture;
uniform sampler2D _depthTexture;
uniform TextureParameters2D _texParams;
uniform bool _renderBackground = false;
void main() {
out_Color = texture(_colorTexture, ex_TexCoord.xy);
gl_FragDepth = texture(_depthTexture, ex_TexCoord.xy).r;
if (_renderBackground) {
out_Color = blendBackground(ex_TexCoord.xy, out_Color);
}
}
......@@ -147,6 +147,9 @@ namespace campvis {
float ratioRatio = sliceRatio / renderTargetRatio;
tgt::mat4 modelMatrix = (ratioRatio > 1) ? tgt::mat4::createScale(tgt::vec3(1.f, 1.f / ratioRatio, 1.f)) : tgt::mat4::createScale(tgt::vec3(ratioRatio, 1.f, 1.f));
if (p_sliceOrientation.getValue() == XY_PLANE)
modelMatrix.t11 *= -1;
// prepare OpenGL
_shader->activate();
decorateRenderProlog(data, _shader);
......@@ -186,7 +189,7 @@ namespace campvis {
modelMatrix.t11 = 0.f;
modelMatrix.t03 = 0.f;
modelMatrix.t13 = 2.f * sliceTexCoord.y - 1.f;
modelMatrix.t13 *= (ratioRatio > 1) ? 1.f / ratioRatio : 1.f;
modelMatrix.t13 *= (ratioRatio > 1) ? -1.f / ratioRatio : -1.f;
_shader->setUniform("_modelMatrix", modelMatrix);
_shader->setUniform("_color", p_ySliceColor.getValue());
QuadRdr.renderQuad(GL_LINE_STRIP);
......
......@@ -32,6 +32,7 @@
#include "core/datastructures/renderdata.h"
#include "core/classification/simpletransferfunction.h"
#include "core/pipeline/processordecoratorbackground.h"
#include "core/tools/quadrenderer.h"
namespace campvis {
......@@ -57,6 +58,9 @@ namespace campvis {
addProperty(&p_inputVolume);
addProperty(&p_outputImage);
addDecorator(new ProcessorDecoratorBackground());
decoratePropertyCollection(this);
p_seProperties.addPropertyCollection(_sliceExtractor);
_sliceExtractor.p_lqMode.setVisible(false);
_sliceExtractor.p_sourceImageID.setVisible(false);
......@@ -100,7 +104,7 @@ namespace campvis {
_raycaster.init();
_sliceExtractor.init();
_shader = ShdrMgr.load("core/glsl/passthrough.vert", "modules/vis/glsl/quadview.frag", "");
_shader = ShdrMgr.load("core/glsl/passthrough.vert", "modules/vis/glsl/volumeexplorer.frag", "");
_shader->setAttributeLocation(0, "in_Position");
_shader->setAttributeLocation(1, "in_TexCoord");
......@@ -181,14 +185,20 @@ namespace campvis {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (vrImage != 0) {
decorateRenderProlog(data, _shader);
_shader->setUniform("_renderBackground", true);
vrImage->bind(_shader, colorUnit, depthUnit);
float ratio = static_cast<float>(vrs.x) / static_cast<float>(rts.x);
_shader->setUniform("_modelMatrix", tgt::mat4::createScale(tgt::vec3(vrs.x, vrs.y, .5f)));
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(srs.x, 0.f, 0.f)));
_quad->render(GL_POLYGON);
_shader->setUniform("_renderBackground", false);
decorateRenderEpilog(_shader);
}
if (xSliceImage != 0) {
xSliceImage->bind(_shader, colorUnit, depthUnit);
if (zSliceImage != 0) {
zSliceImage->bind(_shader, colorUnit, depthUnit);
_shader->setUniform("_modelMatrix", tgt::mat4::createScale(tgt::vec3(srs.x, srs.y, .5f)));
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(0.f, 2.f * srs.y, 0.f)));
_quad->render(GL_POLYGON);
......@@ -199,8 +209,8 @@ namespace campvis {
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(0.f, srs.y, 0.f)));
_quad->render(GL_POLYGON);
}
if (zSliceImage != 0) {
zSliceImage->bind(_shader, colorUnit, depthUnit);
if (xSliceImage != 0) {
xSliceImage->bind(_shader, colorUnit, depthUnit);
_shader->setUniform("_modelMatrix", tgt::mat4::createScale(tgt::vec3(srs.x, srs.y, .5f)));
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(0.f, 0.f, 0.f)));
_quad->render(GL_POLYGON);
......
......@@ -31,7 +31,9 @@
#include "core/eventhandlers/trackballnavigationeventlistener.h"
#include "core/eventhandlers/transfuncwindowingeventlistener.h"
#include "core/pipeline/abstractprocessordecorator.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/metaproperty.h"
......@@ -49,7 +51,7 @@ namespace campvis {
/**
* Combines a volume raycaster and 3 slice views for explorative volume visualization.
*/
class VolumeExplorer : public VisualizationProcessor, public tgt::EventListener {
class VolumeExplorer : public VisualizationProcessor, public HasProcessorDecorators, public tgt::EventListener {
public:
/**
* Constructs a new VolumeExplorer Processor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment