X-Git-Url: https://gitweb.ps.run/subsurface_scattering/blobdiff_plain/c99ecda7bed596922125f6b1ef1ef2ae8f27703e..416072629c59a86ced2c20fcab625914adc64ebf:/src/main2.cpp diff --git a/src/main2.cpp b/src/main2.cpp index 206466d..e57639a 100644 --- a/src/main2.cpp +++ b/src/main2.cpp @@ -20,6 +20,10 @@ #include #include + +// 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, 1.633992f, 0.036795f, @@ -383,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; @@ -409,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; @@ -470,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); @@ -514,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); @@ -569,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);