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 987cde43 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

cleanup for merge back.

parent dbeeab39
......@@ -107,7 +107,7 @@ namespace campvis {
cgt::GlContextManager::getRef().acquireContext(_canvas, false);
while (! _stopExecution) {
if (_enabled /*&& _pipelineDirty*/) {
if (_enabled && _pipelineDirty) {
// mark pipeline as not dirty
_pipelineDirty = false;
......@@ -154,7 +154,7 @@ namespace campvis {
// execute processor if needed
if (processor->getEnabled() && !processor->isLocked()) {
//if (! processor->isValid()) {
if (! processor->isValid()) {
tbb::tick_count startTime;
if (processor->getClockExecutionTime())
startTime = tbb::tick_count::now();
......@@ -173,7 +173,7 @@ namespace campvis {
tbb::tick_count endTime = tbb::tick_count::now();
LINFO("Executed processor " << processor->getName() << " duration: " << (endTime - startTime).seconds());
}
//}
}
}
}
......
......@@ -102,7 +102,7 @@ namespace campvis {
const_cast<cgt::Texture*>(tex)->setFilter(cgt::Texture::MIPMAP);
glGenerateMipmap(GL_TEXTURE_3D);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
LGL_ERROR;
}
......
......@@ -75,7 +75,6 @@ namespace campvis {
if (img != 0) {
cgt::vec3 originalSize(img->getSize());
//cgt::ivec3 resampledSize(cgt::ceil(originalSize * p_resampleScale.getValue()));
const cgt::ivec3& resampledSize = p_targetSize.getValue();
cgt::TextureUnit inputUnit;
......
......@@ -33,6 +33,8 @@ layout(location = 2) out vec4 out_FHN; ///< outgoing fragment first hit no
#include "tools/texture3d.frag"
#include "tools/transferfunction.frag"
#include "modules/vis/glsl/voxelhierarchy.frag"
uniform vec2 _viewportSizeRCP;
uniform float _jitterStepSizeMultiplier;
......@@ -47,7 +49,7 @@ uniform sampler2D _exitPoints;
uniform sampler2D _exitPointsDepth;
uniform TextureParameters2D _exitParams;
// DRR volume
// Input volume
uniform sampler3D _volume;
uniform TextureParameters3D _volumeTextureParams;
......@@ -55,134 +57,12 @@ uniform TextureParameters3D _volumeTextureParams;
uniform sampler1D _transferFunction;
uniform TFParameters1D _transferFunctionParams;
// XOR Bitmask texture
uniform usampler2D _xorBitmask;
// BBV Lookup volume
uniform usampler2D _vvTexture;
uniform int _vvVoxelSize;
uniform int _vvVoxelDepth;
uniform int _vvMaxMipMapLevel;
uniform ivec3 _vvSize;
uniform LightSource _lightSource;
uniform vec3 _cameraPosition;
uniform float _samplingStepSize;
#ifdef INTERSECTION_REFINEMENT
bool _inVoid = false;
#endif
#ifdef ENABLE_SHADOWING
uniform float _shadowIntensity;
#endif
// TODO: copy+paste from Voreen - eliminate or improve.
const float SAMPLING_BASE_INTERVAL_RCP = 200.0;
float originalTFar = -1.0;
const int MAXSTEPS = 20;
float OFFSET = 0.001;
// a minimal version of the method above
// (we assume: ray always hits the box)
float IntersectBoxOnlyTFar(in vec3 origin, in vec3 dir, in vec3 box_min, in vec3 box_max)
{
vec3 tmin = (box_min - origin) / dir;
vec3 tmax = (box_max - origin) / dir;
vec3 real_max = max(tmin,tmax);
// the minimal maximum is tFar
// clamp to 1.0
return min(1.0, min( min(real_max.x, real_max.y), real_max.z));
}
bool intersectBits(in uvec4 bitRay, in ivec2 texel, in int level, out uvec4 intersectionBitmask)
{
//texel = clamp(texel, ivec2(0), ivec2(_vvSize / pow(2.0, level)) - 2);
// Fetch bitmask from hierarchy and compute intersection via bitwise AND
intersectionBitmask = (bitRay & texelFetch(_vvTexture, texel, level));
return (intersectionBitmask != uvec4(0));
}
bool intersectHierarchy2(in vec3 origin, in vec3 direction, in int level, in vec3 posTNear, out float tFar, out uvec4 intersectionBitmask) {
// Calculate pixel coordinates ([0,width]x[0,height])
// of the current position along the ray
float res = float(1 << (_vvMaxMipMapLevel - level));
ivec2 pixelCoord = ivec2(posTNear.xy * res);
// Voxel width and height in the unit cube
vec2 voxelWH = vec2(1.0) / res;
// Compute voxel stack (AABB) in the unit cube
// belonging to this pixel position
vec2 box_min = pixelCoord * voxelWH; // (left, bottom)
// Compute intersection with the bounding box
// It is always assumed that an intersection occurs and
// that the position of posTNear remains the same
tFar = IntersectBoxOnlyTFar(origin, direction,
vec3(box_min, 0.0),
vec3(box_min + voxelWH, 1.0));
// Now test if some of the bits intersect
float zFar = (tFar * direction.z) + origin.z ;
// Fetch bitmask for ray and intersect with current pixel
return intersectBits(
texture(_xorBitmask, vec2(min(posTNear.z, zFar), max(posTNear.z, zFar))),
pixelCoord,
level,
intersectionBitmask);
}
float clipFirstHitpoint(in vec3 origin, in vec3 direction, in float tNear, in float tFar) {
// Compute the exit position of the ray with the scene’s BB
// tFar = rayBoxIntersection(origin, direction, vec3(0.0), vec3(1.0), tNear);
// if (tFar > originalTFar) {
// vec3 foo = origin + tFar * direction;
// out_FHN = vec4(foo, 1.0);
// tFar = originalTFar;
// }
// Set current position along the ray to the ray’s origin
vec3 posTNear = origin;
bool intersectionFound = false;
uvec4 intersectionBitmask = uvec4(0);
// It’s faster to not start at the coarsest level
int level = _vvMaxMipMapLevel / 2;
for (int i = 0; (i < MAXSTEPS) && (tNear < tFar) && (!intersectionFound); i++) {
float newTFar = 1.0;
if (intersectHierarchy2(origin, direction, level, posTNear, newTFar, intersectionBitmask)) {
// If we are at mipmap level 0 and an intersection occurred,
// we have found an intersection of the ray with the volume
intersectionFound = (level == 0);
// Otherwise we have to move down one level and
// start testing from there
--level;
}
else {
// If no intersection occurs, we have to advance the
// position on the ray to test the next element of the hierachy.
// Furthermore, add a small offset computed beforehand to
// handle floating point inaccuracy.
tNear = newTFar + OFFSET;
posTNear = origin + tNear * direction;
// Move one level up
++level;
}
}
return tNear;
}
/**
* Performs the raycasting and returns the final fragment color.
*/
......@@ -195,7 +75,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
direction.y = (abs(direction.y) < 0.0000001) ? 0.0000001 : direction.y;
direction.z = (abs(direction.z) < 0.0000001) ? 0.0000001 : direction.z;
OFFSET = (0.25 / (1 << _vvMaxMipMapLevel)); //< offset value used to avoid self-intersection or previous voxel intersection.
OFFSET = (0.25 / (1 << _vhMaxMipMapLevel)); //< offset value used to avoid self-intersection or previous voxel intersection.
jitterEntryPoint(entryPoint, direction, _samplingStepSize * _jitterStepSizeMultiplier);
......
// =============-===================================================================================
//
// 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.
//
// ================================================================================================
// XOR Bitmask texture
uniform usampler2D _xorBitmask;
// BBV Lookup volume
uniform usampler2D _voxelHierarchy;
uniform int _vhMaxMipMapLevel;
const int MAXSTEPS = 20;
float OFFSET = 0.001;
// a minimal version of the method above
// (we assume: ray always hits the box)
float IntersectBoxOnlyTFar(in vec3 origin, in vec3 dir, in vec3 box_min, in vec3 box_max)
{
vec3 tmin = (box_min - origin) / dir;
vec3 tmax = (box_max - origin) / dir;
vec3 real_max = max(tmin,tmax);
// the minimal maximum is tFar
// clamp to 1.0
return min(1.0, min( min(real_max.x, real_max.y), real_max.z));
}
bool intersectBits(in uvec4 bitRay, in ivec2 texel, in int level, out uvec4 intersectionBitmask)
{
// Fetch bitmask from hierarchy and compute intersection via bitwise AND
intersectionBitmask = (bitRay & texelFetch(_voxelHierarchy, texel, level));
return (intersectionBitmask != uvec4(0));
}
bool intersectHierarchy(in vec3 origin, in vec3 direction, in int level, in vec3 posTNear, out float tFar, out uvec4 intersectionBitmask) {
// Calculate pixel coordinates ([0,width]x[0,height])
// of the current position along the ray
float res = float(1 << (_vhMaxMipMapLevel - level));
ivec2 pixelCoord = ivec2(posTNear.xy * res);
// Voxel width and height in the unit cube
vec2 voxelWH = vec2(1.0) / res;
// Compute voxel stack (AABB) in the unit cube
// belonging to this pixel position
vec2 box_min = pixelCoord * voxelWH; // (left, bottom)
// Compute intersection with the bounding box
// It is always assumed that an intersection occurs and
// that the position of posTNear remains the same
tFar = IntersectBoxOnlyTFar(origin, direction,
vec3(box_min, 0.0),
vec3(box_min + voxelWH, 1.0));
// Now test if some of the bits intersect
float zFar = (tFar * direction.z) + origin.z ;
// Fetch bitmask for ray and intersect with current pixel
return intersectBits(
texture(_xorBitmask, vec2(min(posTNear.z, zFar), max(posTNear.z, zFar))),
pixelCoord,
level,
intersectionBitmask);
}
float clipFirstHitpoint(in vec3 origin, in vec3 direction, in float tNear, in float tFar) {
// Compute the exit position of the ray with the scene’s BB
// tFar = rayBoxIntersection(origin, direction, vec3(0.0), vec3(1.0), tNear);
// if (tFar > originalTFar) {
// vec3 foo = origin + tFar * direction;
// out_FHN = vec4(foo, 1.0);
// tFar = originalTFar;
// }
// Set current position along the ray to the ray’s origin
vec3 posTNear = origin;
bool intersectionFound = false;
uvec4 intersectionBitmask = uvec4(0);
// It’s faster to not start at the coarsest level
int level = _vhMaxMipMapLevel / 2;
for (int i = 0; (i < MAXSTEPS) && (tNear < tFar) && (!intersectionFound); i++) {
float newTFar = 1.0;
if (intersectHierarchy(origin, direction, level, posTNear, newTFar, intersectionBitmask)) {
// If we are at mipmap level 0 and an intersection occurred,
// we have found an intersection of the ray with the volume
intersectionFound = (level == 0);
// Otherwise we have to move down one level and
// start testing from there
--level;
}
else {
// If no intersection occurs, we have to advance the
// position on the ray to test the next element of the hierachy.
// Furthermore, add a small offset computed beforehand to
// handle floating point inaccuracy.
tNear = newTFar + OFFSET;
posTNear = origin + tNear * direction;
// Move one level up
++level;
}
}
return tNear;
}
......@@ -84,6 +84,9 @@ namespace campvis {
ScopedTypedData<LightSourceData> light(data, p_lightId.getValue());
if (p_enableShading.getValue() == false || light != nullptr) {
// undo MIPMAP hack from RaycastingProcessor, as mipmapping results in artifacts during ray clipping...
const_cast<cgt::Texture*>(image->getTexture())->setFilter(cgt::Texture::LINEAR);
_shader->activate();
cgt::TextureUnit xorUnit, bbvUnit;
......@@ -95,11 +98,8 @@ namespace campvis {
_vhm->getHierarchyTexture()->bind();
{
cgt::Shader::IgnoreUniformLocationErrorGuard guard(_shader);
_shader->setUniform("_vvTexture", bbvUnit.getUnitNumber());
_shader->setUniform("_vvVoxelSize", static_cast<int>(_vhm->getBrickSize()));
_shader->setUniform("_vvVoxelDepth", static_cast<int>(_vhm->getBrickDepth()));
_shader->setUniform("_vvMaxMipMapLevel", static_cast<int>(_vhm->getMaxMipmapLevel()));
_shader->setUniform("_vvSize", _vhm->getHierarchyTexture()->getDimensions());
_shader->setUniform("_voxelHierarchy", bbvUnit.getUnitNumber());
_shader->setUniform("_vhMaxMipMapLevel", static_cast<int>(_vhm->getMaxMipmapLevel()));
}
if (p_enableShading.getValue() && light != nullptr) {
......@@ -113,7 +113,7 @@ namespace campvis {
createAndAttachDepthTexture();
static const GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 , GL_COLOR_ATTACHMENT3 };
static const GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 };
glDrawBuffers(4, buffers);
glEnable(GL_DEPTH_TEST);
......
......@@ -69,9 +69,9 @@ namespace campvis {
if (p_enableShading.getValue() == false || light != nullptr) {
FramebufferActivationGuard fag(this);
createAndAttachTexture(GL_RGBA8, GL_COLOR_ATTACHMENT0);
createAndAttachTexture(GL_RGBA32F, GL_COLOR_ATTACHMENT1);
createAndAttachTexture(GL_RGBA32F, GL_COLOR_ATTACHMENT2);
createAndAttachTexture(GL_RGBA8);
createAndAttachTexture(GL_RGBA32F);
createAndAttachTexture(GL_RGBA32F);
createAndAttachDepthTexture();
static const GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 };
......
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