From 4971d693fdfbd60a18dc7bf789330a70c92a2a29 Mon Sep 17 00:00:00 2001 From: Martin Opat Date: Sat, 11 Jan 2025 13:25:24 +0100 Subject: [PATCH] Fixed some TODOs, removed old comments --- src/consts.h | 2 +- src/illumination/shading.cu | 1 - src/main.cu | 25 ++++++------------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/consts.h b/src/consts.h index ef8cce1..d53abff 100644 --- a/src/consts.h +++ b/src/consts.h @@ -28,7 +28,7 @@ const float MAX_SPEED = 14.0f; // --------------------------- Raycasting Constants --------------------------- const int SAMPLES_PER_PIXEL = 1; -const float alphaAcumLimit = 1.0f; // TODO: Idk what a good accumulation value is <--- This finally does something when using alpha in both places at least +const float alphaAcumLimit = 1.0f; // TODO: Atm, this does not work very intuitively, other parameters control transparency const float minAllowedDensity = 0.001f; const float stepSize = 0.02f; diff --git a/src/illumination/shading.cu b/src/illumination/shading.cu index 41141f0..8fa8970 100644 --- a/src/illumination/shading.cu +++ b/src/illumination/shading.cu @@ -1,6 +1,5 @@ #include "shading.h" -// TODO: Consider wrapping this in a class (?) __device__ Vec3 phongShading(const Vec3& normal, const Vec3& lightDir, const Vec3& viewDir, const Vec3& baseColor) { Vec3 ambient = baseColor * ambientStrength; double diff = fmax(normal.dot(lightDir), 0.0); diff --git a/src/main.cu b/src/main.cu index 942e4ae..e3faac7 100644 --- a/src/main.cu +++ b/src/main.cu @@ -60,19 +60,15 @@ int main() { std::cout << "DATA size: " << data.size() << std::endl; - // TODO: Eveontually remove debug below (i.e., eliminate for-loop etc.) - // Generate debug volume data + // TODO: Eventually, we should not need to load the volume like this float* hostVolume = new float[VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH]; - // generateVolume(hostVolume, VOLUME_WIDTH, VOLUME_HEIGHT, VOLUME_DEPTH); - int inftyCount=0; for (int i = 0; i < VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH; i++) { - // Discard temperatures above a small star (supposedly, missing temperature values) hostVolume[i] = data[i + 0*VOLUME_DEPTH*VOLUME_HEIGHT*VOLUME_WIDTH]; - if (data[i + 0*VOLUME_DEPTH*VOLUME_HEIGHT*VOLUME_WIDTH] + epsilon >= infty) {hostVolume[i] = -infty; inftyCount++;} + // Discard missing values + if (data[i + 0*VOLUME_DEPTH*VOLUME_HEIGHT*VOLUME_WIDTH] + epsilon >= infty) hostVolume[i] = -infty; } - std::cout << "inftyCount: " << inftyCount << std::endl; - // Reverse the order of hostVolume + // Reverse the order of hostVolume TODO: Idk why the volume upside down, this can probably be deleted and substituted with a minus sign somehwere (camera position?) for (int i = 0; i < VOLUME_WIDTH; i++) { for (int j = 0; j < VOLUME_HEIGHT; j++) { for (int k = 0; k < VOLUME_DEPTH/2; k++) { @@ -83,8 +79,7 @@ int main() { } } - - // Store the half-way up slice data into a file + // Store the half-way up slice data into a file TODO: Remove this debug std::ofstream myfile; myfile.open("halfwayup.txt"); for (int i = 0; i < VOLUME_WIDTH; i++) { @@ -95,6 +90,7 @@ int main() { } myfile.close(); + // Print min, max, avg., and median values TODO: Remove this debug float minVal = *std::min_element(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH, [](float a, float b) { if (a <= epsilon) return false; if (b <= epsilon) return true; @@ -102,15 +98,6 @@ int main() { }); float maxVal = *std::max_element(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH); std::cout << "minVal: " << minVal << " maxVal: " << maxVal << std::endl; - - // Min-max normalization TODO: Decide whether to keep the normalization here but probably not - // Normalize to [0, 1] - // Temperature: min: 0 max: 1 avg: 0.776319 median: 0.790567 - // Speed: min: 0 max: 1 avg: 0.132117 median: 0.0837869 - // for (int i = 0; i < VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH; i++) { - // hostVolume[i] = (hostVolume[i] - minVal) / (maxVal - minVal); - // } - // // print min, max, avg., and median values <--- the code actually does not work when this snippet is enabled so probably TODO: Delete this later // std::sort(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH); // float sum = std::accumulate(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH, 0.0f);