Fixed rays not interacting with missing volume incorrectly when number of samples > 1
This commit is contained in:
parent
3714389803
commit
1aa33e8e14
|
|
@ -26,9 +26,9 @@ const float MAX_SPEED = 14.0f;
|
||||||
|
|
||||||
|
|
||||||
// --------------------------- Raycasting Constants ---------------------------
|
// --------------------------- 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 minAllowedDensity = 0.001f;
|
||||||
|
|
||||||
const float stepSize = 0.02f;
|
const float stepSize = 0.02f;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer) {
|
||||||
float accumR = 0.0f;
|
float accumR = 0.0f;
|
||||||
float accumG = 0.0f;
|
float accumG = 0.0f;
|
||||||
float accumB = 0.0f;
|
float accumB = 0.0f;
|
||||||
float accumA = 1.0f;
|
float accumA = 1.0f * (float)SAMPLES_PER_PIXEL;
|
||||||
|
|
||||||
// Initialize random state for ray scattering
|
// Initialize random state for ray scattering
|
||||||
curandState randState;
|
curandState randState;
|
||||||
|
|
@ -77,6 +77,7 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer) {
|
||||||
accumG = d_backgroundColor.y * (float)SAMPLES_PER_PIXEL;
|
accumG = d_backgroundColor.y * (float)SAMPLES_PER_PIXEL;
|
||||||
accumB = d_backgroundColor.z * (float)SAMPLES_PER_PIXEL;
|
accumB = d_backgroundColor.z * (float)SAMPLES_PER_PIXEL;
|
||||||
accumA = 1.0f * (float)SAMPLES_PER_PIXEL;
|
accumA = 1.0f * (float)SAMPLES_PER_PIXEL;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (tNear < 0.0f) tNear = 0.0f;
|
if (tNear < 0.0f) tNear = 0.0f;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue