Added background colour to consts.h

This commit is contained in:
Martin committed 2025-01-11 13:05:18 +01:00
1 parent a5c66fc6ca
commit 9afd242121
3 files changed
+13 -7

No files matched your search

+7 -7
View File
@@ -72,9 +72,9 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer) {
if (tNear > tFar) {
// No intersection -> Set to brackground color (multiply by SAMPLES_PER_PIXEL because we divide by it later)
accumR = 0.1f * (float)SAMPLES_PER_PIXEL;
accumG = 0.1f * (float)SAMPLES_PER_PIXEL;
accumB = 0.1f * (float)SAMPLES_PER_PIXEL;
accumR = d_backgroundColor.x * (float)SAMPLES_PER_PIXEL;
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;
@@ -119,11 +119,11 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer) {
accumB += colorB;
accumA += alphaAccum;
// Blend with background (for transparency) // TODO: Put background colour in a constant
// Blend with background (for transparency)
float leftover = 1.0 - alphaAccum;
accumR = accumR + leftover * 0.1f;
accumG = accumG + leftover * 0.1f;
accumB = accumB + leftover * 0.1f;
accumR = accumR + leftover * d_backgroundColor.x;
accumG = accumG + leftover * d_backgroundColor.y;
accumB = accumB + leftover * d_backgroundColor.z;
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.