\r
void main()\r
{\r
- if (renderState == 0) {\r
- FragColor = texture(shadowmapTexture, TexCoords);\r
- }\r
- else if (renderState == 1) {\r
- FragColor = texture(irradianceTexture, TexCoords);\r
- }\r
- else if (renderState == 2) {\r
- // sample calculated irradiance\r
- // using Gaussian kernel to approximate light spread\r
- vec4 result = vec4(0, 0, 0, 1);\r
- for (int i = 0; i < 13; i++) {\r
- vec2 sampleCoords = TexCoords + samplePositions[i] * vec2(1.0/screenWidth, 1.0/screenHeight);\r
- //vec4 sample = texture(irradianceTexture, sampleCoords)\r
- // * texture(shadowmapTexture, sampleCoords);\r
- vec4 sample = texture(irradianceTexture, sampleCoords);\r
- vec4 weight = vec4(sampleWeights[i], 1);\r
- result += sample * weight;\r
- }\r
- FragColor = result;\r
+ // sample calculated irradiance\r
+ // using Gaussian kernel to approximate light spread\r
+ vec4 result = vec4(0, 0, 0, 1);\r
+ for (int i = 0; i < 13; i++) {\r
+ vec2 sampleCoords = TexCoords + samplePositions[i] * vec2(1.0/screenWidth, 1.0/screenHeight);\r
+ //vec4 sample = texture(irradianceTexture, sampleCoords)\r
+ // * texture(shadowmapTexture, sampleCoords);\r
+ vec4 sample = texture(irradianceTexture, sampleCoords);\r
+ vec4 weight = vec4(sampleWeights[i], 1);\r
+ result += sample * weight;\r
}\r
+ FragColor = result;\r
}\r
// thickness\r
float distanceToBackside = length(FragPos - Backside);\r
\r
- if (renderState == 2) {\r
- if (distanceToBackside != 0) {\r
- // add translucency by amplifying color inverse to the thickness\r
- // (1 - diff) is part of the irradiance term,\r
- // if the light hits the object straight at 90°\r
- // most light is received\r
- result += objectColor * pow(powBase, powFactor / pow(distanceToBackside, 0.6)) * transmittanceScale * (1 - diff);\r
- }\r
+ if (distanceToBackside != 0) {\r
+ // add translucency by amplifying color inverse to the thickness\r
+ // (1 - diff) is part of the irradiance term,\r
+ // if the light hits the object straight at 90°\r
+ // most light is received\r
+ result += objectColor * pow(powBase, powFactor / pow(distanceToBackside, 0.6)) * transmittanceScale * (1 - diff);\r
}\r
\r
FragColor = vec4(result, 1.0f);\r
ImGui::Begin("Options");\r
ImGui::Checkbox("Wireframe", &options.wireframe);\r
ImGui::Checkbox("Free Cam", &options.freecam);\r
- ImGui::InputInt("Render State", &options.renderState);\r
ImGui::DragFloat3("Color", options.color, 0.01, 0, 1);\r
ImGui::DragFloat("Transmittance Scale", &options.transmittanceScale, 0.0001f, 0, 0.3);\r
ImGui::DragFloat3("Light Pos", glm::value_ptr(options.lightPos), 0.01, -5, 5);\r
ImGui::Begin("Options");\r
ImGui::Checkbox("Wireframe", &options.wireframe);\r
ImGui::Checkbox("Free Cam", &options.freecam);\r
- ImGui::InputInt("Render State", &options.renderState);\r
ImGui::DragFloat3("Color", options.color, 0.01, 0, 1);\r
ImGui::DragFloat("Transmittance Scale", &options.transmittanceScale, 0.0001f, 0, 0.3);\r
ImGui::DragFloat("Pow Base", &options.powBase, 0.01f, 0, 4);\r