Renamed GUI elements
This commit is contained in:
parent
1b32469a69
commit
edcde639da
|
|
@ -49,14 +49,14 @@ void Widget::tick(double fps) {
|
||||||
float min = -1, max = 1;
|
float min = -1, max = 1;
|
||||||
|
|
||||||
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("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");
|
||||||
|
|
||||||
// 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
|
||||||
// whatever value is selected here is available on the gpu as d_tfComboSelected.
|
// whatever value is selected here is available on the gpu as d_tfComboSelected.
|
||||||
const char* items[] = {"First option", "Another option", "this is the third option", "..."};
|
const char* items[] = {"Opacity - gradient", "Opacity - sigmoid", "Opacity - constant", "..."};
|
||||||
if (ImGui::BeginCombo("ComboBox for transferFunction", items[this->tfComboSelected]))
|
if (ImGui::BeginCombo("ComboBox for transferFunction", items[this->tfComboSelected]))
|
||||||
{
|
{
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
__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(-1 * gradMag); // TODO: This parameter probably has the wrong scale
|
float alpha = 1.0f - expf(-d_opacityK * gradMag); // TODO: This parameter probably has the wrong scale
|
||||||
return alpha;
|
return alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,12 +51,26 @@ __device__ float4 transferFunction(float density, const Vec3& grad, const Point3
|
||||||
|
|
||||||
// TODO: This is a Gui select element
|
// TODO: This is a Gui select element
|
||||||
// TODO: Add a way to pick different function for alpha
|
// TODO: Add a way to pick different function for alpha
|
||||||
float alpha = opacityFromGradient(grad);
|
float alpha;
|
||||||
// alpha = 0.1f;
|
switch (d_tfComboSelected) {
|
||||||
// alpha = opacitySigmoid(normDensity);
|
case 0:
|
||||||
// alpha = (1.0f - fabs(grad.normalize().dot(rayDir.normalize()))) * 0.8f + 0.2f;
|
alpha = opacityFromGradient(grad);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
alpha = opacitySigmoid(normDensity);
|
||||||
|
break;
|
||||||
|
|
||||||
float alphaSample = density * alpha * 0.1;
|
case 2:
|
||||||
|
alpha = 0.1f;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
alpha = 1.0f; // This should not be reached anyway
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
float alphaSample = density * alpha * 0.1; // TODO: Why is this still 0.1?
|
||||||
|
|
||||||
// --------------------------- Shading ---------------------------
|
// --------------------------- Shading ---------------------------
|
||||||
// Apply Phong
|
// Apply Phong
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue