summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Park <SebPark03@gmail.com>2024-05-10 00:33:27 -0400
committerSebastian Park <SebPark03@gmail.com>2024-05-10 00:33:27 -0400
commit8f61cdb6c394b7c32a495966c7ad3a088c91c17b (patch)
treec5de34e832b822e17bfff3238138dd7a5851b1e8
parent7a61605e57d96bf5c699c9c759288376b8c94eac (diff)
Fix messed up bind framebuffer.
-rw-r--r--resources/shaders/caustics.frag2
-rw-r--r--resources/shaders/caustics.vert2
-rw-r--r--src/arap.cpp2
-rwxr-xr-xsrc/glwidget.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/resources/shaders/caustics.frag b/resources/shaders/caustics.frag
index f746896..5d2569d 100644
--- a/resources/shaders/caustics.frag
+++ b/resources/shaders/caustics.frag
@@ -14,7 +14,7 @@ void main() {
float oldArea = length(dFdx(vec3(pos[0], pos[2], pos[1]))) * length(dFdy(vec3(pos[0], pos[2], pos[1])));
float newArea = length(dFdx(vec3(newPos[0], newPos[2], newPos[1]))) * length(dFdy(vec3(newPos[0], newPos[2], newPos[1])));
float areaRatio = oldArea / newArea;
- float intensity = pow(areaRatio * .3f, 1.5f);
+ float intensity = pow(areaRatio * 1.f, 1.5f);
fragColor = vec4(0.98, 1, .78, intensity * refractProb);
// fragColor = col;
}
diff --git a/resources/shaders/caustics.vert b/resources/shaders/caustics.vert
index 298f5e1..f1e80be 100644
--- a/resources/shaders/caustics.vert
+++ b/resources/shaders/caustics.vert
@@ -45,7 +45,7 @@ void main() {
vec4 sampledNormal = texture(normSamp, vec2((pos + 1) / 2));
sampledNormal = (sampledNormal * 2.f) - 1.f;
col = sampledNormal;
- vec4 newPosAndProb = refractToFloor(vec3(0, 0, 1), pos, normalize(vec3(sampledNormal)), 0.01f);
+ vec4 newPosAndProb = refractToFloor(vec3(0, 0, 1), pos, normalize(vec3(sampledNormal)), 0.005f);
newPos = vec3(newPosAndProb[0], newPosAndProb[1], 0.f);
refractProb = newPosAndProb[3];
// newPos = pos;
diff --git a/src/arap.cpp b/src/arap.cpp
index ae7240d..2e4532b 100644
--- a/src/arap.cpp
+++ b/src/arap.cpp
@@ -52,7 +52,7 @@ void ARAP::init
minCorner = coeffMin;
maxCorner = coeffMax;
- initCausticsShape(10);
+ initCausticsShape(1000);
}
void ARAP::update(double seconds)
diff --git a/src/glwidget.cpp b/src/glwidget.cpp
index 1e9b26b..8a35a4f 100755
--- a/src/glwidget.cpp
+++ b/src/glwidget.cpp
@@ -212,7 +212,7 @@ void GLWidget::paintCaustics() {
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glBindFramebuffer(GL_FRAMEBUFFER, m_fbo_texture);
+ glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable( GL_BLEND );