X-Git-Url: https://gitweb.ps.run/subsurface_scattering/blobdiff_plain/36fb27a899045de24d71d55b06648abda7547268..HEAD:/src/main2.cpp?ds=sidebyside diff --git a/src/main2.cpp b/src/main2.cpp index 38ca5f2..e57639a 100644 --- a/src/main2.cpp +++ b/src/main2.cpp @@ -20,18 +20,9 @@ #include #include -/* -TODO: -- Save Depth to fbo -- Stencil Buffer -- LightDist > 1 - - 1 - distanceToBackside in frag_irradiance -- ShadowMap Perspective (no projection?) -- (Implement Gaussian Blur) -- LightDir nicht immer zu 0 0 0 - -*/ +// sample positions and weights for a Gaussian kernel from +// Hable, John ; Borshukov, George ; Hejl, Jim: Fast Skin Shading. In: ShaderX7, ShaderX : Charles River Media, 2009, S. 161–173 float samplePositions[] = { 0.000000f, 0.000000f, @@ -396,7 +387,6 @@ int main() { GLuint shaderProgramIrradiance = compileShaders("shaders/ts_vert_irradiance.glsl", "shaders/ts_frag_irradiance.glsl"); GLuint shaderProgramCombine = compileShaders("shaders/ts_vert.glsl", "shaders/ts_frag.glsl"); - //model m = loadModel("models/Isotrop-upperjaw.ply"); model m = loadModel("models/african_head/african_head.obj"); arccam arcCam; @@ -422,10 +412,10 @@ int main() { bool freecam = false; int renderState = 1; float color[3] = { 0.7f, 0.4f, 0.4f }; - glm::vec3 lightPos = glm::vec3(0.0f, 0.0f, 0.25f); + glm::vec3 lightPos = glm::vec3(0.0f, 0.0f, 2.5f); float transmittanceScale = 0.005f; - float powBase = 2.718; - float powFactor = 1; + float powBase = 2; + float powFactor = 1.5; } DefaultOptions; auto options = DefaultOptions; @@ -483,7 +473,7 @@ int main() { prevMouse = sf::Mouse::isButtonPressed(sf::Mouse::Right); - // Render Shadowmap + // Render Shadowmap to fbo glBindFramebuffer(GL_FRAMEBUFFER, fb_irradiance.fbo); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); @@ -527,9 +517,7 @@ int main() { m.draw(); - - - // Render fbo to screen + // Render model and calculate light spread and translucency in shader glBindFramebuffer(GL_FRAMEBUFFER, 0); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); @@ -582,27 +570,17 @@ int main() { glActiveTexture(GL_TEXTURE0 + 0); glBindTexture(GL_TEXTURE_2D, fb_irradiance.renderTexture); - // glBindVertexArray(fb_irradiance.screenVAO); - // glUniform1i(glGetUniformLocation(fb_irradiance.screenShaderProgram, "shadowmapTexture"), 0); - // glActiveTexture(GL_TEXTURE0 + 0); - // glBindTexture(GL_TEXTURE_2D, fb_irradiance.renderTexture); - // glDrawArrays(GL_TRIANGLES, 0, 6); - // glBindVertexArray(0); - m.draw(); - + // menu ImGui::SFML::Update(window, deltaClock.restart()); ImGui::Begin("Options"); ImGui::Checkbox("Wireframe", &options.wireframe); ImGui::Checkbox("Free Cam", &options.freecam); - ImGui::InputInt("Render State", &options.renderState); ImGui::DragFloat3("Color", options.color, 0.01, 0, 1); ImGui::DragFloat("Transmittance Scale", &options.transmittanceScale, 0.0001f, 0, 0.3); - ImGui::DragFloat("Pow Base", &options.powBase, 0.01f, 0, 4); - ImGui::DragFloat("Pow Factor", &options.powFactor, 0.01f, 0, 3); ImGui::DragFloat3("Light Pos", glm::value_ptr(options.lightPos), 0.01, -5, 5); if (options.freecam) { ImGui::LabelText("Position", "%f %f %f", freeCam.pos.x, freeCam.pos.y, freeCam.pos.z);