diff --git a/src/consts.h b/src/consts.h index d53abff..2686450 100644 --- a/src/consts.h +++ b/src/consts.h @@ -26,9 +26,9 @@ const float MAX_SPEED = 14.0f; // --------------------------- Raycasting Constants --------------------------- -const int SAMPLES_PER_PIXEL = 1; +const int SAMPLES_PER_PIXEL = 4; -const float alphaAcumLimit = 1.0f; // TODO: Atm, this does not work very intuitively, other parameters control transparency +const float alphaAcumLimit = 0.4f; // TODO: Atm, this only works with sigmoid const float minAllowedDensity = 0.001f; const float stepSize = 0.02f; diff --git a/src/illumination/Raycaster.cu b/src/illumination/Raycaster.cu index c9015cf..b2d1939 100644 --- a/src/illumination/Raycaster.cu +++ b/src/illumination/Raycaster.cu @@ -21,7 +21,7 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer) { float accumR = 0.0f; float accumG = 0.0f; float accumB = 0.0f; - float accumA = 1.0f; + float accumA = 1.0f * (float)SAMPLES_PER_PIXEL; // Initialize random state for ray scattering curandState randState; @@ -77,6 +77,7 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer) { accumG = d_backgroundColor.y * (float)SAMPLES_PER_PIXEL; accumB = d_backgroundColor.z * (float)SAMPLES_PER_PIXEL; accumA = 1.0f * (float)SAMPLES_PER_PIXEL; + } else { if (tNear < 0.0f) tNear = 0.0f;