mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Imgui denoise
This commit is contained in:
@ -100,6 +100,7 @@ int Camera::portalTeleport(Scene *scene, float delta_time)
|
||||
|
||||
if (distance_portal <= distance_future_pos && glm::dot(glm::normalize(future_pos - _position), obj.normal) > 0.0f)
|
||||
{
|
||||
std::cout << "Teleportation" << std::endl;
|
||||
GPUObject linked_portal = scene->getObjectData()[obj.radius];
|
||||
|
||||
glm::mat4 portal_transform = linked_portal.transform * glm::inverse(obj.transform);
|
||||
|
@ -33,6 +33,11 @@ Scene::Scene(std::string &name)
|
||||
_gpu_debug.triangle_treshold = 1;
|
||||
_gpu_debug.box_treshold = 1;
|
||||
|
||||
_gpu_denoise.enabled = 0;
|
||||
_gpu_denoise.pass = 0;
|
||||
_gpu_denoise.c_phi = 0.1f;
|
||||
_gpu_denoise.p_phi = 0.1f;
|
||||
_gpu_denoise.n_phi = 0.1f;
|
||||
|
||||
if (!file.is_open())
|
||||
{
|
||||
@ -364,6 +369,11 @@ GPUDebug &Scene::getDebug()
|
||||
return (_gpu_debug);
|
||||
}
|
||||
|
||||
GPUDenoise &Scene::getDenoise()
|
||||
{
|
||||
return (_gpu_denoise);
|
||||
}
|
||||
|
||||
std::vector<GPUBvhData> &Scene::getBvhData()
|
||||
{
|
||||
return (_gpu_bvh_data);
|
||||
|
@ -300,6 +300,16 @@ GLuint Shader::getProgramComputeDenoising(void) const
|
||||
return (_program_denoising);
|
||||
}
|
||||
|
||||
GLuint Shader::getNormalTexture(void) const
|
||||
{
|
||||
return (_normal_texture);
|
||||
}
|
||||
|
||||
GLuint Shader::getPositionTexture(void) const
|
||||
{
|
||||
return (_position_texture);
|
||||
}
|
||||
|
||||
std::vector<float> Shader::getOutputImage(void)
|
||||
{
|
||||
std::vector<float> res(WIDTH * HEIGHT * 4);
|
||||
|
@ -272,17 +272,37 @@ void Window::imGuiRender()
|
||||
has_changed = true;
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Denoiser"))
|
||||
{
|
||||
ImGui::PushID(0);
|
||||
|
||||
ImGui::Checkbox("Enable", (bool *)(&_scene->getDenoise().enabled));
|
||||
ImGui::Separator();
|
||||
if (ImGui::SliderInt("Pass", &_scene->getDenoise().pass, 0, 8))
|
||||
_scene->getDenoise().pass = (_scene->getDenoise().pass / 2) * 2; // make sure it's even
|
||||
|
||||
ImGui::SliderFloat("Color diff", &_scene->getDenoise().c_phi, 0.0f, 1.0f);
|
||||
ImGui::SliderFloat("Position diff", &_scene->getDenoise().p_phi, 0.0f, 1.0f);
|
||||
ImGui::SliderFloat("Normal diff", &_scene->getDenoise().n_phi, 0.0f, 1.0f);
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Debug"))
|
||||
{
|
||||
ImGui::PushID(0);
|
||||
|
||||
has_changed |= ImGui::Checkbox("Enable", (bool *)(&_scene->getDebug().enabled));
|
||||
ImGui::Separator();
|
||||
has_changed |= ImGui::SliderInt("Debug mode", &_scene->getDebug().mode, 0, 2);
|
||||
has_changed |= ImGui::SliderInt("Box treshold", &_scene->getDebug().box_treshold, 1, 2000);
|
||||
has_changed |= ImGui::SliderInt("Triangle treshold", &_scene->getDebug().triangle_treshold, 1, 2000);
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
_renderer->renderImgui();;
|
||||
|
||||
_renderer->renderImgui();
|
||||
|
||||
ImGui::End();
|
||||
|
||||
|
Reference in New Issue
Block a user