Renamed sigmoid GUI params
This commit is contained in:
parent
6085a77c66
commit
1b32469a69
|
|
@ -49,6 +49,6 @@ void copyConstantsToDevice() {
|
||||||
|
|
||||||
// ----------------------- TransferFunction -----------------------
|
// ----------------------- TransferFunction -----------------------
|
||||||
__device__ float d_opacityK;
|
__device__ float d_opacityK;
|
||||||
__device__ float d_sigmoidOne;
|
__device__ float d_sigmoidShift;
|
||||||
__device__ float d_sigmoidTwo;
|
__device__ float d_sigmoidExp;
|
||||||
__device__ int d_tfComboSelected;
|
__device__ int d_tfComboSelected;
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ struct ColorStop {
|
||||||
// factor for the opacity function
|
// factor for the opacity function
|
||||||
extern __device__ float d_opacityK;
|
extern __device__ float d_opacityK;
|
||||||
// sigmoid function variables
|
// sigmoid function variables
|
||||||
extern __device__ float d_sigmoidOne;
|
extern __device__ float d_sigmoidShift;
|
||||||
extern __device__ float d_sigmoidTwo;
|
extern __device__ float d_sigmoidExp;
|
||||||
// combo box index
|
// combo box index
|
||||||
extern __device__ int d_tfComboSelected;
|
extern __device__ int d_tfComboSelected;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ Widget::Widget(GLFWwindow* window) {
|
||||||
this->renderOnce = false;
|
this->renderOnce = false;
|
||||||
|
|
||||||
this->opacityK = 0;
|
this->opacityK = 0;
|
||||||
this->sigmoidOne = 0.5f;
|
this->sigmoidShift = 0.5f;
|
||||||
this->sigmoidTwo = -250.0f;
|
this->sigmoidExp = -250.0f;
|
||||||
this->tfComboSelected = 0;
|
this->tfComboSelected = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -50,8 +50,8 @@ void Widget::tick(double fps) {
|
||||||
|
|
||||||
ImGui::Begin("Transfer Function Controls");
|
ImGui::Begin("Transfer Function Controls");
|
||||||
ImGui::DragInt("k (log [1e-10, 1])", &this->opacityK, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
ImGui::DragInt("k (log [1e-10, 1])", &this->opacityK, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
||||||
ImGui::DragFloat("sigmoidOne", &this->sigmoidOne, 0.01f, 0.0f, 1.0f, "%.2f");
|
ImGui::DragFloat("sigmoidShift", &this->sigmoidShift, 0.01f, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::InputFloat("sigmoidTwo", &this->sigmoidTwo, 10.0f, 100.0f, "%.0f");
|
ImGui::InputFloat("sigmoidExp", &this->sigmoidExp, 10.0f, 100.0f, "%.0f");
|
||||||
|
|
||||||
// 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
|
||||||
// the default entry is set in the constructor, so if you want that to be a specific entry just change it
|
// the default entry is set in the constructor, so if you want that to be a specific entry just change it
|
||||||
|
|
@ -115,8 +115,8 @@ void Widget::copyToDevice() {
|
||||||
this->opacityKReal = std::pow(10.0f, (-10 + 0.1 * this->opacityK));
|
this->opacityKReal = std::pow(10.0f, (-10 + 0.1 * this->opacityK));
|
||||||
cudaMemcpyToSymbol(&d_opacityK, &this->opacityKReal, sizeof(float));
|
cudaMemcpyToSymbol(&d_opacityK, &this->opacityKReal, sizeof(float));
|
||||||
|
|
||||||
cudaMemcpyToSymbol(&d_sigmoidOne, &this->sigmoidOne, sizeof(float));
|
cudaMemcpyToSymbol(&d_sigmoidShift, &this->sigmoidShift, sizeof(float));
|
||||||
cudaMemcpyToSymbol(&d_sigmoidTwo, &this->sigmoidTwo, sizeof(float));
|
cudaMemcpyToSymbol(&d_sigmoidExp, &this->sigmoidExp, sizeof(float));
|
||||||
cudaMemcpyToSymbol(&d_tfComboSelected, &this->tfComboSelected, sizeof(float));
|
cudaMemcpyToSymbol(&d_tfComboSelected, &this->tfComboSelected, sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ public:
|
||||||
int tfComboSelected;
|
int tfComboSelected;
|
||||||
int opacityK;
|
int opacityK;
|
||||||
float opacityKReal;
|
float opacityKReal;
|
||||||
float sigmoidOne;
|
float sigmoidShift;
|
||||||
float sigmoidTwo;
|
float sigmoidExp;
|
||||||
|
|
||||||
ImGuiIO io;
|
ImGuiIO io;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
__device__ float opacityFromGradient(const Vec3 &grad) {
|
__device__ float opacityFromGradient(const Vec3 &grad) {
|
||||||
float gradMag = grad.length();
|
float gradMag = grad.length();
|
||||||
float alpha = 1.0f - expf(-d_opacityK * gradMag); // TODO: This parameter probably has the wrong scale
|
float alpha = 1.0f - expf(-1 * gradMag); // TODO: This parameter probably has the wrong scale
|
||||||
return alpha;
|
return alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
__device__ float opacitySigmoid(float val) {
|
__device__ float opacitySigmoid(float val) {
|
||||||
return 1.0f / (1.0f + expf(d_sigmoidTwo * (val - d_sigmoidOne)));
|
return 1.0f / (1.0f + expf(d_sigmoidExp * (val - d_sigmoidShift)));
|
||||||
}
|
}
|
||||||
|
|
||||||
__device__ Color3 colorMap(float normalizedValues, const ColorStop stops[], int N) {
|
__device__ Color3 colorMap(float normalizedValues, const ColorStop stops[], int N) {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ __device__ Vec3 computeGradient(float* volumeData, const int volW, const int vol
|
||||||
float hy = DLON; // y => width => lon
|
float hy = DLON; // y => width => lon
|
||||||
float hz = DLEV; // z => depth => alt
|
float hz = DLEV; // z => depth => alt
|
||||||
|
|
||||||
|
// Default
|
||||||
float dfdx = (sampleVolumeTrilinear(volumeData, volW, volH, volD, fx + hx, fy, fz) -
|
float dfdx = (sampleVolumeTrilinear(volumeData, volW, volH, volD, fx + hx, fy, fz) -
|
||||||
sampleVolumeTrilinear(volumeData, volW, volH, volD, fx - hx, fy, fz)) / (2.0f * hx);
|
sampleVolumeTrilinear(volumeData, volW, volH, volD, fx - hx, fy, fz)) / (2.0f * hx);
|
||||||
|
|
||||||
|
|
@ -71,6 +72,14 @@ __device__ Vec3 computeGradient(float* volumeData, const int volW, const int vol
|
||||||
float dfdz = (sampleVolumeTrilinear(volumeData, volW, volH, volD, fx, fy, fz + hz) -
|
float dfdz = (sampleVolumeTrilinear(volumeData, volW, volH, volD, fx, fy, fz + hz) -
|
||||||
sampleVolumeTrilinear(volumeData, volW, volH, volD, fx, fy, fz - hz)) / (2.0f * hz);
|
sampleVolumeTrilinear(volumeData, volW, volH, volD, fx, fy, fz - hz)) / (2.0f * hz);
|
||||||
|
|
||||||
|
// // DEBUG (TODO: Delete) - Back to nearest
|
||||||
|
// float dfdx = (sampleVolumeNearest(volumeData, volW, volH, volD, (int)roundf(fx + 1), (int)roundf(fy), (int)roundf(fz)) -
|
||||||
|
// sampleVolumeNearest(volumeData, volW, volH, volD, (int)roundf(fx - 1), (int)roundf(fy), (int)roundf(fz))) / (2.0f * hx);
|
||||||
|
// float dfdy = (sampleVolumeNearest(volumeData, volW, volH, volD, (int)roundf(fx), (int)roundf(fy + 1), (int)roundf(fz)) -
|
||||||
|
// sampleVolumeNearest(volumeData, volW, volH, volD, (int)roundf(fx), (int)roundf(fy - 1), (int)roundf(fz))) / (2.0f * hy);
|
||||||
|
// float dfdz = (sampleVolumeNearest(volumeData, volW, volH, volD, (int)roundf(fx), (int)roundf(fy), (int)roundf(fz + 1)) -
|
||||||
|
// sampleVolumeNearest(volumeData, volW, volH, volD, (int)roundf(fx), (int)roundf(fy), (int)roundf(fz - 1))) / (2.0f * hz);
|
||||||
|
|
||||||
return Vec3::init(dfdx, dfdy, dfdz);
|
return Vec3::init(dfdx, dfdy, dfdz);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue