aboutsummaryrefslogtreecommitdiff
path: root/BuddhaTest/Shaders/BuddhaFragment.glsl
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2018-03-23 23:14:50 +0100
committerAndreas Grois <andi@grois.info>2018-03-23 23:14:50 +0100
commit183f60d1305e4de6729882f18311090b33d5374b (patch)
tree1e0015ca056ca7a3621553cbe3390b10db934c4e /BuddhaTest/Shaders/BuddhaFragment.glsl
parentb8082e3ef23758ce0f3a541aecf5a87efe3c1d53 (diff)
Back to full image size buffers, and range support in shader
Diffstat (limited to 'BuddhaTest/Shaders/BuddhaFragment.glsl')
-rw-r--r--BuddhaTest/Shaders/BuddhaFragment.glsl9
1 files changed, 6 insertions, 3 deletions
diff --git a/BuddhaTest/Shaders/BuddhaFragment.glsl b/BuddhaTest/Shaders/BuddhaFragment.glsl
index 52a0354..ac8114b 100644
--- a/BuddhaTest/Shaders/BuddhaFragment.glsl
+++ b/BuddhaTest/Shaders/BuddhaFragment.glsl
@@ -21,14 +21,17 @@ uniform float colorScale;
uvec3 getColorAt(vec2 fragCoord)
{
uint xIndex = uint(max(0.0,(fragCoord.x+1.0)*0.5*width));
- uint yIndex = uint(max(0.0,abs(fragCoord.y)*height));
+ uint yIndex = uint(max(0.0,abs(fragCoord.y+1.0)*0.5*height));
uint firstIndex = 3*(xIndex + yIndex * width);
- return uvec3(counts_SSBO[firstIndex],counts_SSBO[firstIndex+1],counts_SSBO[firstIndex+2]);
+ uvec3 c1=uvec3(counts_SSBO[firstIndex],counts_SSBO[firstIndex+1],counts_SSBO[firstIndex+2]);
+ firstIndex = 3*(xIndex +(height-1 - yIndex) * width);
+ uvec3 c2=uvec3(counts_SSBO[firstIndex],counts_SSBO[firstIndex+1],counts_SSBO[firstIndex+2]);
+ return c1+c2;
}
void main(){
uvec3 totalCount = getColorAt(uv);
- vec3 scaled = pow(min(vec3(1.0),colorScale*vec3(totalCount)/max(float(brightness),1.0)),vec3(gamma));
+ vec3 scaled = pow(min(vec3(1.0),colorScale*0.5*vec3(totalCount)/max(float(brightness),1.0)),vec3(gamma));
color = scaled;
}