Added alpha accum gui param
This commit is contained in:
parent
fca8ea3e84
commit
f11eff0e96
|
|
@ -51,6 +51,7 @@ void copyConstantsToDevice() {
|
||||||
__device__ float d_opacityK;
|
__device__ float d_opacityK;
|
||||||
__device__ float d_sigmoidShift;
|
__device__ float d_sigmoidShift;
|
||||||
__device__ float d_sigmoidExp;
|
__device__ float d_sigmoidExp;
|
||||||
|
__device__ float d_alphaAcumLimit;
|
||||||
__device__ int d_tfComboSelected;
|
__device__ int d_tfComboSelected;
|
||||||
__device__ int d_tfComboSelectedColor;
|
__device__ int d_tfComboSelectedColor;
|
||||||
__device__ float d_opacityConst;
|
__device__ float d_opacityConst;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ const float MAX_SPEED = 14.0f;
|
||||||
// --------------------------- Raycasting Constants ---------------------------
|
// --------------------------- Raycasting Constants ---------------------------
|
||||||
const int SAMPLES_PER_PIXEL = 4;
|
const int SAMPLES_PER_PIXEL = 4;
|
||||||
|
|
||||||
const float alphaAcumLimit = 0.4f; // TODO: Atm, this only works with sigmoid
|
// 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;
|
||||||
|
|
@ -67,6 +67,8 @@ extern __device__ float d_opacityK;
|
||||||
// sigmoid function variables
|
// sigmoid function variables
|
||||||
extern __device__ float d_sigmoidShift;
|
extern __device__ float d_sigmoidShift;
|
||||||
extern __device__ float d_sigmoidExp;
|
extern __device__ float d_sigmoidExp;
|
||||||
|
// alpha accumulation limit
|
||||||
|
extern __device__ float d_alphaAcumLimit;
|
||||||
// combo box index
|
// combo box index
|
||||||
extern __device__ int d_tfComboSelected;
|
extern __device__ int d_tfComboSelected;
|
||||||
extern __device__ int d_tfComboSelectedColor;
|
extern __device__ int d_tfComboSelectedColor;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ Widget::Widget(GLFWwindow* window) {
|
||||||
this->opacityK = 0;
|
this->opacityK = 0;
|
||||||
this->sigmoidShift = 0.5f;
|
this->sigmoidShift = 0.5f;
|
||||||
this->sigmoidExp = -250.0f;
|
this->sigmoidExp = -250.0f;
|
||||||
|
this->alphaAcumLimit = 0.4f;
|
||||||
this->tfComboSelected = 0;
|
this->tfComboSelected = 0;
|
||||||
this->opacityConst = 100;
|
this->opacityConst = 100;
|
||||||
};
|
};
|
||||||
|
|
@ -53,6 +54,7 @@ void Widget::tick(double fps) {
|
||||||
ImGui::DragInt("Gradient exp. (log [1e-10, 1])", &this->opacityK, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
ImGui::DragInt("Gradient exp. (log [1e-10, 1])", &this->opacityK, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
||||||
ImGui::DragFloat("sigmoidShift", &this->sigmoidShift, 0.01f, 0.0f, 1.0f, "%.2f");
|
ImGui::DragFloat("sigmoidShift", &this->sigmoidShift, 0.01f, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::InputFloat("sigmoidExp", &this->sigmoidExp, 10.0f, 100.0f, "%.0f");
|
ImGui::InputFloat("sigmoidExp", &this->sigmoidExp, 10.0f, 100.0f, "%.0f");
|
||||||
|
ImGui::DragFloat("Alpha accumulation limit", &this->alphaAcumLimit, 0.01f, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::DragInt("Opacity constant (log [1e-5, 1])", &this->opacityConst, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
ImGui::DragInt("Opacity constant (log [1e-5, 1])", &this->opacityConst, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
||||||
|
|
||||||
// the items[] contains the entries for the combobox. The selected index is stored as an int on this->tfComboSelected
|
// the items[] contains the entries for the combobox. The selected index is stored as an int on this->tfComboSelected
|
||||||
|
|
@ -130,6 +132,7 @@ void Widget::copyToDevice() {
|
||||||
|
|
||||||
cudaMemcpyToSymbol(&d_sigmoidShift, &this->sigmoidShift, sizeof(float));
|
cudaMemcpyToSymbol(&d_sigmoidShift, &this->sigmoidShift, sizeof(float));
|
||||||
cudaMemcpyToSymbol(&d_sigmoidExp, &this->sigmoidExp, sizeof(float));
|
cudaMemcpyToSymbol(&d_sigmoidExp, &this->sigmoidExp, sizeof(float));
|
||||||
|
cudaMemcpyToSymbol(&d_alphaAcumLimit, &this->alphaAcumLimit, sizeof(float));
|
||||||
cudaMemcpyToSymbol(&d_tfComboSelected, &this->tfComboSelected, sizeof(int));
|
cudaMemcpyToSymbol(&d_tfComboSelected, &this->tfComboSelected, sizeof(int));
|
||||||
|
|
||||||
this->opacityConstReal = std::pow(10.0f, (-5 + 0.05 * this->opacityConst));
|
this->opacityConstReal = std::pow(10.0f, (-5 + 0.05 * this->opacityConst));
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ public:
|
||||||
float opacityKReal;
|
float opacityKReal;
|
||||||
float sigmoidShift;
|
float sigmoidShift;
|
||||||
float sigmoidExp;
|
float sigmoidExp;
|
||||||
|
float alphaAcumLimit;
|
||||||
int opacityConst;
|
int opacityConst;
|
||||||
float opacityConstReal;
|
float opacityConstReal;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ __global__ void raycastKernel(float* volumeData, FrameBuffer framebuffer, const
|
||||||
float alphaAccum = 0.0f;
|
float alphaAccum = 0.0f;
|
||||||
|
|
||||||
float t = tNear; // Front to back
|
float t = tNear; // Front to back
|
||||||
while (t < tFar && alphaAccum < alphaAcumLimit) {
|
while (t < tFar && alphaAccum < d_alphaAcumLimit) {
|
||||||
Point3 pos = d_cameraPos + rayDir * t;
|
Point3 pos = d_cameraPos + rayDir * t;
|
||||||
|
|
||||||
// Convert to volume indices
|
// Convert to volume indices
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue