Commit 3ed32957 authored by Johannes Maul's avatar Johannes Maul
Browse files

Real Example working. New Todo: EXP and LOG as Wrapper around

parent 3b218397
......@@ -10,7 +10,7 @@ function easyExample(exampleType, buildDefault)
load("exampleTest.mat");
elseif exampleType == "real" && ~overwriteLoad
if isfile("exampleReal.mat")
%load();
load("exampleReal.mat");
else
Disp("exampleReal.mat not found, try another example");
return;
......@@ -39,10 +39,10 @@ function easyExample(exampleType, buildDefault)
[nodes,faces] = vol2surf(testVolume,1:testVolumeSize(1),1:testVolumeSize(2),1:testVolumeSize(3),1.5,1,'cgalsurf',isoValues);
faces = unique(faces,'rows'); %special for vol2mesh were the outer layer got an air layer which destroys the calculation
faces(:,4) = faces(:,4) - 1; %currently non dynamic labels
nodes(:,1:2) = nodes(:,1:2) + 10;
nodes(:,1:2) = nodes(:,1:2) +10;
end
[projection, profiling] = nv_ray_tracing_basic(detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues' ); %parameters always in this order
[projection,debug, debugMiss, profiling] = nv_ray_tracing_basic(detectorPositionCoordinates, faces, nodes, source, detectorSizeUint,attenuationCoefficentValues' ); %parameters always in this order
times = reformatProfile(profiling);
% debugMissFormated = reshape(debugMiss,[200 detectorSizeUint(1) detectorSizeUint(2)]);
projectionAsImage = reshape(projection,detectorSizeUint);
......@@ -51,7 +51,7 @@ function easyExample(exampleType, buildDefault)
end
function [sizeX, sizeY, detectorPositions] = createOwnExample(exampleType)
sizeX = 800;
sizeX = 600;
sizeY = floor(sizeX * 16 / 9);
if exampleType == "test"
......
......@@ -50,14 +50,15 @@ void main()
uint attValId = gl_LaunchIDNV.x + gl_LaunchIDNV.y * gl_LaunchSizeNV.x;
attVal.values[attValId] = 0;
//int debugCounter = 1;
int debugCounter = 5;
if (rayPayload.hitCounter != 0)
{
const uint n = uint(rayPayload.hitCounter - mod(rayPayload.hitCounter, 2)); //Abschnitt getestet, indem verglichen mit Matlab. Bei Ungleichheit stop. Kein Stop => ERg = gleich
//debug.values[rayPayload.outputId] = n;
uint n = uint(rayPayload.hitCounter - mod(rayPayload.hitCounter, 2)); //Abschnitt getestet, indem verglichen mit Matlab. Bei Ungleichheit stop. Kein Stop => ERg = gleich
debug.values[rayPayload.outputId] = n;
if (n > sizeZ )
n = sizeZ-2;
//permutation: sortieren nach kleinster distanz
uint permutationIndices[sizeZ];
......@@ -145,33 +146,34 @@ void main()
{
// debug.values[rayPayload.outputId+i] += length((finalDistances[i] - finalDistances[i+1]) * rayDir);
// attenuationValue += length((finalDistances[i] - finalDistances[i+1]) * rayDir);
// debug.values[rayPayload.outputId+debugCounter] = finalDistances[i];
// debugCounter++;
// debug.values[rayPayload.outputId+debugCounter] = finalDistances[i+1];
// debugCounter++;
// debug.values[rayPayload.outputId+debugCounter] = finalFaces[i]-1;
// debugCounter++;
debug.values[rayPayload.outputId+debugCounter] = finalDistances[i];
debugCounter++;
debug.values[rayPayload.outputId+debugCounter] = finalDistances[i+1];
debugCounter++;
debug.values[rayPayload.outputId+debugCounter] = finalFaces[i]-1;
debugCounter++;
attenuationValue += length((finalDistances[i] - finalDistances[i+1]) *rayDir) * attCoefDyn.values[finalFaces[i]-1];
// debug.values[rayPayload.outputId+debugCounter] = attenuationValue;
// debugCounter++;
debug.values[rayPayload.outputId+debugCounter] = attenuationValue;
debugCounter++;
//debug.values[rayPayload.outputId+i] = length((finalDistances[i] - finalDistances[i+1]) * rayDir) * attCoef.attCoefVal[finalFaces[i]-1];
}
// debug.values[rayPayload.outputId+debugCounter] = attenuationValue;
// debugCounter++;
attenuationValue = exp(float(attenuationValue * attCoef.attCoefVal.w));
// debug.values[rayPayload.outputId+debugCounter] = attenuationValue;
// debugCounter++;
debug.values[rayPayload.outputId+debugCounter] = attenuationValue * attCoef.attCoefVal.w;
debugCounter++;
debug.values[rayPayload.outputId+4] = attenuationValue * attCoef.attCoefVal.w;
// attenuationValue = exp(float(attenuationValue * attCoef.attCoefVal.w));
debug.values[rayPayload.outputId+debugCounter+1] = attenuationValue;
debugCounter++;
// debug.values[rayPayload.outputId] = attenuationValue;
// if(attenuationValue != 0)
// {
attVal.values[attValId] = -log(float(attenuationValue));
// debug.values[rayPayload.outputId] = attVal.values[attValId];
// debugCounter++;
attVal.values[attValId] = attenuationValue;
debug.values[rayPayload.outputId + 2] = attVal.values[attValId];
debugCounter++;
// }
// attVal.values[attValId] = attenuationValue;
// attVal.values[attValId] = 1;
// debug.values[rayPayload.outputId] = attVal.values[attValId];
// debug.values[rayPayload.outputId+debugCounter] = debugCounter+1;
debug.values[rayPayload.outputId+3] = debugCounter+1;
}
// debug.values[rayPayload.outputId] = attVal.values[attValId];
......
#version 460
#extension GL_NV_ray_tracing : require
//#define debug 0
#define debug 0
layout(binding = 0, set = 0) uniform accelerationStructureNV topLevelAS;
//layout(binding = 1, set = 0, rgba8) uniform image2D image;
......
//#define debug //if this line is commented, you have comment it in the shaders too!
#define debug //if this line is commented, you have comment it in the shaders too!
#define profile
//#define advancedOutput //fr primitives und distances
......@@ -1573,7 +1573,7 @@ void mexFunction(int interfaceOutputs,
outputPosition++;
output[outputPosition] = mxCreateDoubleMatrix(1,
detectorSize[0]* detectorSize[1] * static_cast<uint32_t>(atCoVal.sizeZ.z),
detectorSize[0] * detectorSize[1] * static_cast<uint32_t>(atCoVal.sizeZ.z),
mxREAL);
tmpDebug = mxGetPr(output[outputPosition]);
memcpy(tmpDebug,
......
Supports Markdown
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