Simple GPU Path Tracing, Part 6 : GUI

 

As we progress in our implementation, it can become useful to be able to tweak some parameters on the fly, rather than having to compile the whole thing everytime we want to change something.

That's why it's time to implement a super simple GUI, using dearimgui.


Here's the commit for this post  

It's all going to be super basic, so I'm not going to go into too much details, but will just show how it works.

I created a gui class that will implement all the user interface stuff. I added it as a member of application, and we call 

GUI->GUI();

in the main loop function.

the way it works is we have a left panel with all the gui, and the main rendered image on the right.

on the left panel are multiple tabs that will allow to manage multiple aspects of the app : 

  • Instances
  • Materials
  • Shapes
  • Cameras
  • Textures
  • Tracing parameters

Not all the interfaces are fully implemented yet, and we will improve the gui as we go.

But at least, this will allow to move objects around in the scene, to change material properties and path tracing properties, all of that on the fly, which is going to be quite helpful !

Here's the core of the Gui() function : 

if (ImGui::BeginTabItem("Instances"))
        {
            if(InstancesGUI())
            {
                App->ResetRender=true;
            }
            ImGui::EndTabItem();
        }
        if (ImGui::BeginTabItem("Materials"))
        {
            if(MaterialsGUI())
            {
                App->ResetRender = true;
            }
            ImGui::EndTabItem();
        }
        if (ImGui::BeginTabItem("Shapes"))
        {
            ShapesGUI();
            ImGui::EndTabItem();
        }
        if (ImGui::BeginTabItem("Cameras"))
        {
            if(CamerasGUI())
            {
                App->ResetRender=true;
            }
            ImGui::EndTabItem();
        }
        if (ImGui::BeginTabItem("Textures"))
        {
            TexturesGUI();
            ImGui::EndTabItem();
        }
        if (ImGui::BeginTabItem("Tracing Params"))
        {
            if(TracingGUI())
            {
                App->ResetRender = true;
            }
            ImGui::EndTabItem();
        }
        ImGui::EndTabBar();

Each tab has its own function, this is very basic imgui code so I won't show all the details, and it's not so interesting anyway.

Next Post : Simple GPU Path Tracing, Part 7.0 : Transparency

Commentaires

Articles les plus consultés