diff options
| -rw-r--r-- | shaders/fbo_frag.glsl | 30 | ||||
| -rw-r--r-- | shaders/frag_irradiance.glsl | 14 | ||||
| -rw-r--r-- | src/main.cpp | 1 | ||||
| -rw-r--r-- | src/main2.cpp | 1 |
4 files changed, 17 insertions, 29 deletions
diff --git a/shaders/fbo_frag.glsl b/shaders/fbo_frag.glsl index f92483e..8ffc0ce 100644 --- a/shaders/fbo_frag.glsl +++ b/shaders/fbo_frag.glsl @@ -13,24 +13,16 @@ uniform vec3 sampleWeights[13]; void main()
{
- if (renderState == 0) {
- FragColor = texture(shadowmapTexture, TexCoords);
- }
- else if (renderState == 1) {
- FragColor = texture(irradianceTexture, TexCoords);
- }
- else if (renderState == 2) {
- // sample calculated irradiance
- // using Gaussian kernel to approximate light spread
- vec4 result = vec4(0, 0, 0, 1);
- for (int i = 0; i < 13; i++) {
- vec2 sampleCoords = TexCoords + samplePositions[i] * vec2(1.0/screenWidth, 1.0/screenHeight);
- //vec4 sample = texture(irradianceTexture, sampleCoords)
- // * texture(shadowmapTexture, sampleCoords);
- vec4 sample = texture(irradianceTexture, sampleCoords);
- vec4 weight = vec4(sampleWeights[i], 1);
- result += sample * weight;
- }
- FragColor = result;
+ // sample calculated irradiance
+ // using Gaussian kernel to approximate light spread
+ vec4 result = vec4(0, 0, 0, 1);
+ for (int i = 0; i < 13; i++) {
+ vec2 sampleCoords = TexCoords + samplePositions[i] * vec2(1.0/screenWidth, 1.0/screenHeight);
+ //vec4 sample = texture(irradianceTexture, sampleCoords)
+ // * texture(shadowmapTexture, sampleCoords);
+ vec4 sample = texture(irradianceTexture, sampleCoords);
+ vec4 weight = vec4(sampleWeights[i], 1);
+ result += sample * weight;
}
+ FragColor = result;
}
diff --git a/shaders/frag_irradiance.glsl b/shaders/frag_irradiance.glsl index b985acf..2a7edec 100644 --- a/shaders/frag_irradiance.glsl +++ b/shaders/frag_irradiance.glsl @@ -40,14 +40,12 @@ void main() // thickness
float distanceToBackside = length(FragPos - Backside);
- if (renderState == 2) {
- if (distanceToBackside != 0) {
- // add translucency by amplifying color inverse to the thickness
- // (1 - diff) is part of the irradiance term,
- // if the light hits the object straight at 90°
- // most light is received
- result += objectColor * pow(powBase, powFactor / pow(distanceToBackside, 0.6)) * transmittanceScale * (1 - diff);
- }
+ if (distanceToBackside != 0) {
+ // add translucency by amplifying color inverse to the thickness
+ // (1 - diff) is part of the irradiance term,
+ // if the light hits the object straight at 90°
+ // most light is received
+ result += objectColor * pow(powBase, powFactor / pow(distanceToBackside, 0.6)) * transmittanceScale * (1 - diff);
}
FragColor = vec4(result, 1.0f);
diff --git a/src/main.cpp b/src/main.cpp index 168d01d..4f18e10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -616,7 +616,6 @@ int main() { 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::DragFloat3("Light Pos", glm::value_ptr(options.lightPos), 0.01, -5, 5);
diff --git a/src/main2.cpp b/src/main2.cpp index 5d717e6..c30fb9e 100644 --- a/src/main2.cpp +++ b/src/main2.cpp @@ -579,7 +579,6 @@ int main() { 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);
|
