Fixed rays not interacting with missing volume incorrectly when number of samples > 1

This commit is contained in:
2025-01-11 14:59:27 +01:00
parent 3714389803
commit 1aa33e8e14
2 changed files with 4 additions and 3 deletions

View File

@@ -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;