Carna  Version 3.3.2
drr-exponential.frag
1 #version 330
2 
3 /*
4  * Copyright (C) 2010 - 2015 Leonid Kostrykin
5  *
6  * Chair of Medical Engineering (mediTEC)
7  * RWTH Aachen University
8  * Pauwelsstr. 20
9  * 52074 Aachen
10  * Germany
11  *
12  */
13 
14 uniform sampler2D integralMap;
15 uniform float baseIntensity;
16 uniform int renderInverse;
17 
18 in vec2 textureCoordinates;
19 
20 out vec4 gl_FragColor;
21 
22 
23 // ----------------------------------------------------------------------------------
24 // Fragment Procedure
25 // ----------------------------------------------------------------------------------
26 
27 void main()
28 {
29  float integral = texture( integralMap, textureCoordinates ).r;
30  float result = clamp( baseIntensity * exp( -integral ), 0, 1 );
31 
32  vec3 color = ( 1 - renderInverse ) * vec3( 1, 1, 1 );
33 
34  gl_FragColor = vec4( color, 1 - result );
35 }